feat(worker): MISSING_USER_DATA error when user.json is absent#80
Merged
Androz2091 merged 1 commit intomainfrom May 2, 2026
Merged
feat(worker): MISSING_USER_DATA error when user.json is absent#80Androz2091 merged 1 commit intomainfrom
Androz2091 merged 1 commit intomainfrom
Conversation
Discord exports drop user.json (and the entire Account folder) when
the user un-ticks the 'User data' checkbox in the request form. We
need user.json to anchor the rest of the analysis on the package
owner's identity, so a package without it has nothing useful to
compute.
The old code path landed on a KeyError("There is no item named
'Account/user.json' in the archive") and got relabeled UNKNOWN_ERROR
in process_package — multiple users in production hit this and
retried 4+ times before giving up.
Now: when neither find_user_root() nor either legacy fallback locates
a user.json entry, raise MISSING_USER_DATA. The error code is added
to EXPECTED_ERROR_CODES so it surfaces verbatim through the API
status endpoint instead of being squashed.
Frontend follow-up (separate PR): add MISSING_USER_DATA to the status
response type and copy a friendly message asking the user to
re-export with the User data option enabled.
This was referenced May 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two production packages today hit `UNKNOWN_ERROR` four times each before the user gave up retrying:
```
KeyError: "There is no item named 'Account/user.json' in the archive"
File "/app/tasks.py", line 220, in read_analytics_file
user_content = zip.open(user_path)
```
Root cause: Discord's export request form has a checkbox called User data. If the user un-ticks it, the export package ships without `Account/user.json` (or the localized equivalent). Our worker needs `user.json` for the package owner's identity (id, username, discriminator, avatar) — without it there's nothing meaningful to compute, so we should fail fast with a clear message rather than crash on a missing-key.
What changed
No behavior change for packages that do have `user.json` — the code path resolves to the same `user_path` value.
Frontend follow-up (separate PR)
The status response type in dumpus-app needs `MISSING_USER_DATA` added to the `errorMessageCode` union, plus a friendly copy string along the lines of:
Happy to open that PR right after this merges.
Test plan