fix(accounts): add migration to repair missing selectedAccount#27717
Closed
tommasini wants to merge 1 commit into
Closed
fix(accounts): add migration to repair missing selectedAccount#27717tommasini wants to merge 1 commit into
tommasini wants to merge 1 commit into
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Contributor
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
tommasini
commented
Mar 19, 2026
| ? `wrong_type_${typeof currentValue}` | ||
| : 'empty_string'; | ||
|
|
||
| captureException( |
Contributor
Author
There was a problem hiding this comment.
Probably we want to remove this exception being captured, it seems that will not help with really anything if we get to this point, only pollute sentry
Contributor
|
✅ E2E Fixture Validation — Schema is up to date |
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Description
Sentry reports show users crashing on v7.66.0 with
Account Id "undefined" not foundduring Engine initialization. The root cause is a corruptedAccountsController.internalAccounts.selectedAccountthat is either missing orundefinedin persisted state.Migration 059 attempted to fix this but has a critical gap: it uses
hasProperty(internalAccounts, 'selectedAccount')which returnsfalsewhen the key is entirely absent (the common case after aJSON.stringify/JSON.parseroundtrip stripsundefinedvalues). This means migration 059 silently skips the most common form of this corruption.Migration 126 fixes this by:
undefinedvaluekey_missing,value_undefined,wrong_type_*,empty_string) to Sentry for diagnosticsselectedAccountto the first account ID, or falling back to''(whichAccountsControllerauto-reconciles)Since this is migration 126 (> 107), it runs after
inflateFromControllerspulls the per-controller filesystem data intoengine.backgroundState, so it operates on the actual corrupted data regardless of its origin.Changelog
CHANGELOG entry: Fixed a crash caused by corrupted account selection state during app upgrade
Related issues
Fixes: #11488
Manual testing steps
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Pre-merge reviewer checklist
Made with Cursor