Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sentry] Error: Migration 36: Invalid selectedAddress. state.engine.backgroundState.PreferencesController?.select... #11488

Closed
sentry-io bot opened this issue Sep 27, 2024 · 1 comment · Fixed by #12177
Assignees
Labels
area-Sentry Issue from Sentry regression-prod-7.30.0 Regression bug that was found in production in release 7.30.0 release-7.36.0 Issue or pull request that will be included in release 7.36.0 Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing team-mobile-platform type-bug Something isn't working

Comments

@sentry-io
Copy link

sentry-io bot commented Sep 27, 2024

Sentry Issue: METAMASK-MOBILE-2R0K

Error: Migration 36: Invalid selectedAddress. state.engine.backgroundState.PreferencesController?.selectedAddress is not a string:'string'. Setting selectedAddress to the first account.
  at createSelectedAccountForAccountsController (app:///index.android.bundle:15:41)
  at asyncGeneratorStep (app:///index.android.bundle:338:61)
  at _next (app:///index.android.bundle:508:34)
  at __callReactNativeMicrotasks (shim.js:11:5)
  at anonymous (index.js:24:66)
...
(13 additional frame(s) were not displayed)
@frankvonhoven frankvonhoven added Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing team-mobile-platform labels Sep 27, 2024
@metamaskbot metamaskbot changed the title Error: Migration 36: Invalid selectedAddress. state.engine.backgroundState.PreferencesController?.select... [Sentry] Error: Migration 36: Invalid selectedAddress. state.engine.backgroundState.PreferencesController?.select... Sep 30, 2024
@metamaskbot metamaskbot added type-bug Something isn't working area-Sentry Issue from Sentry regression-prod-7.30.0 Regression bug that was found in production in release 7.30.0 labels Sep 30, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Sep 30, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by team Sep 30, 2024
@gauthierpetetin
Copy link
Contributor

gauthierpetetin commented Oct 17, 2024

This issue seems to not happen anymore since Oct 3.
If that's still the case in 2 weeks, we will close this issue.

github-merge-queue bot pushed a commit that referenced this issue Nov 5, 2024
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

This PR addresses a crasher related to an undefined selectedAccount
causing the AccountsController to throw an error. Under this scenario,
the solution is to set selectedAccount to an empty string, which the
AccountsController will automatically reset the selectedAccount.

PR similar to #11866
but not the same

## **Related issues**

Fixes: #11488 

## **Manual testing steps**

1. Building on `main`, create a wallet and kill the app
2. Create a migration that sets `selectedAccount` on the
AccountsController to be undefined
3. Run the app, notice it encounters the error. Kill the app
4. Run this branch, which includes migration 59. Notice you are no
longer blocked and can log in
5. Will see an account selected by default after landing on wallet

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->
The error that users eventually see as a result of the migration
failures
<img width="1101" alt="Screenshot 2024-11-04 at 11 21 55 PM"
src="https://github.com/user-attachments/assets/c944e7ce-f68d-4cb6-b949-b8b57a4d8ec8">

### **After**

<!-- [screenshots/recordings] -->

After applying migration

https://github.com/user-attachments/assets/e959c8d9-5dfd-4b69-8f4d-16689bf66d95


## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
@github-project-automation github-project-automation bot moved this from To be fixed to Fixed in Bugs by team Nov 5, 2024
@gauthierpetetin gauthierpetetin added the release-7.36.0 Issue or pull request that will be included in release 7.36.0 label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Sentry Issue from Sentry regression-prod-7.30.0 Regression bug that was found in production in release 7.30.0 release-7.36.0 Issue or pull request that will be included in release 7.36.0 Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing team-mobile-platform type-bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants