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: FATAL ERROR: Migration 52: Invalid AccountsController state error: missing internalAccounts.selec... #11866

Closed
sentry-io bot opened this issue Oct 18, 2024 · 0 comments · Fixed by #12115
Assignees
Labels
area-Sentry Issue from Sentry regression-prod-7.32.0 Regression bug that was found in production in release 7.32.0 release-7.34.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 Oct 18, 2024

Sentry Issue: METAMASK-MOBILE-2XVC

Error: FATAL ERROR: Migration 52: Invalid AccountsController state error: missing internalAccounts.selectedAccount
  at ResultError (ses.cjs:7676:17)
  at isAccountsControllerState (app/store/migrations/052.ts:57:11)
  at e.default (app/store/migrations/052.ts:85:8)
  at _ref3 (app/store/migrations/index.ts:134:16)
...
(12 additional frame(s) were not displayed)
@NicolasMassart NicolasMassart 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 Oct 18, 2024
@metamaskbot metamaskbot changed the title Error: FATAL ERROR: Migration 52: Invalid AccountsController state error: missing internalAccounts.selec... [Sentry] Error: FATAL ERROR: Migration 52: Invalid AccountsController state error: missing internalAccounts.selec... Oct 21, 2024
@metamaskbot metamaskbot added type-bug Something isn't working area-Sentry Issue from Sentry regression-prod-7.32.0 Regression bug that was found in production in release 7.32.0 labels Oct 21, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by team Oct 21, 2024
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by severity Oct 21, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 31, 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 fixes #11866
where it ensures that selectedAccount in the AccountsController is
defined.

## **Related issues**

Fixes: #11866

## **Manual testing steps**

1. Run `main` and create a wallet with 3 accounts, select account 1
2. Kill the app and apply a migration that sets `selectedAccount` in the
AccountsController to undefined, re-run yarn watch and re-open app
3. Notice that the app is stuck on the splash screen
4. Kill the app and run this branch, which applies the migration that
fixes the issue. Notice that the app is now accessible again

## **Screenshots/Recordings**

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

### **Before**

<!-- [screenshots/recordings]  -->
<img width="900" alt="Screenshot 2024-10-30 at 4 42 44 PM"
src="https://github.com/user-attachments/assets/394f1b4c-741c-4c7f-993e-b0120e16588e">

<img width="961" alt="Screenshot 2024-10-30 at 4 43 07 PM"
src="https://github.com/user-attachments/assets/37c685b2-925a-45c5-a7c4-7fadec8cba6f">

### **After**

<!-- [screenshots/recordings] -->
App is accessible again
<img width="444" alt="Screenshot 2024-10-30 at 10 11 24 PM"
src="https://github.com/user-attachments/assets/cc0cb9ef-2a5b-4804-a9e8-eac93cc4212d">


## **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 Oct 31, 2024
@metamaskbot metamaskbot added the release-7.35.0 Issue or pull request that will be included in release 7.35.0 label Oct 31, 2024
runway-github bot added a commit that referenced this issue Oct 31, 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 fixes #11866
where it ensures that selectedAccount in the AccountsController is
defined.

## **Related issues**

Fixes: #11866

## **Manual testing steps**

1. Run `main` and create a wallet with 3 accounts, select account 1
2. Kill the app and apply a migration that sets `selectedAccount` in the
AccountsController to undefined, re-run yarn watch and re-open app
3. Notice that the app is stuck on the splash screen
4. Kill the app and run this branch, which applies the migration that
fixes the issue. Notice that the app is now accessible again

## **Screenshots/Recordings**

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

### **Before**

<!-- [screenshots/recordings]  -->
<img width="900" alt="Screenshot 2024-10-30 at 4 42 44 PM"
src="https://github.com/user-attachments/assets/394f1b4c-741c-4c7f-993e-b0120e16588e">

<img width="961" alt="Screenshot 2024-10-30 at 4 43 07 PM"
src="https://github.com/user-attachments/assets/37c685b2-925a-45c5-a7c4-7fadec8cba6f">

### **After**

<!-- [screenshots/recordings] -->
App is accessible again
<img width="444" alt="Screenshot 2024-10-30 at 10 11 24 PM"
src="https://github.com/user-attachments/assets/cc0cb9ef-2a5b-4804-a9e8-eac93cc4212d">


## **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.
runway-github bot added a commit that referenced this issue Oct 31, 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 fixes #11866
where it ensures that selectedAccount in the AccountsController is
defined.

## **Related issues**

Fixes: #11866

## **Manual testing steps**

1. Run `main` and create a wallet with 3 accounts, select account 1
2. Kill the app and apply a migration that sets `selectedAccount` in the
AccountsController to undefined, re-run yarn watch and re-open app
3. Notice that the app is stuck on the splash screen
4. Kill the app and run this branch, which applies the migration that
fixes the issue. Notice that the app is now accessible again

## **Screenshots/Recordings**

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

### **Before**

<!-- [screenshots/recordings]  -->
<img width="900" alt="Screenshot 2024-10-30 at 4 42 44 PM"
src="https://github.com/user-attachments/assets/394f1b4c-741c-4c7f-993e-b0120e16588e">

<img width="961" alt="Screenshot 2024-10-30 at 4 43 07 PM"
src="https://github.com/user-attachments/assets/37c685b2-925a-45c5-a7c4-7fadec8cba6f">

### **After**

<!-- [screenshots/recordings] -->
App is accessible again
<img width="444" alt="Screenshot 2024-10-30 at 10 11 24 PM"
src="https://github.com/user-attachments/assets/cc0cb9ef-2a5b-4804-a9e8-eac93cc4212d">

## **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.
runway-github bot pushed a commit that referenced this issue Oct 31, 2024
… selectedAccount (#12115)

<!--
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 fixes #11866
where it ensures that selectedAccount in the AccountsController is
defined.

## **Related issues**

Fixes: #11866

## **Manual testing steps**

1. Run `main` and create a wallet with 3 accounts, select account 1
2. Kill the app and apply a migration that sets `selectedAccount` in the
AccountsController to undefined, re-run yarn watch and re-open app
3. Notice that the app is stuck on the splash screen
4. Kill the app and run this branch, which applies the migration that
fixes the issue. Notice that the app is now accessible again

## **Screenshots/Recordings**

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

### **Before**

<!-- [screenshots/recordings]  -->
<img width="900" alt="Screenshot 2024-10-30 at 4 42 44 PM"
src="https://github.com/user-attachments/assets/394f1b4c-741c-4c7f-993e-b0120e16588e">

<img width="961" alt="Screenshot 2024-10-30 at 4 43 07 PM"
src="https://github.com/user-attachments/assets/37c685b2-925a-45c5-a7c4-7fadec8cba6f">

### **After**

<!-- [screenshots/recordings] -->
App is accessible again
<img width="444" alt="Screenshot 2024-10-30 at 10 11 24 PM"
src="https://github.com/user-attachments/assets/cc0cb9ef-2a5b-4804-a9e8-eac93cc4212d">


## **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.
NicolasMassart pushed a commit that referenced this issue Oct 31, 2024
… selectedAccount (#12122)

- fix: Reapply migration 52 to fix undefined selectedAccount (#12115)

<!--
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 fixes #11866
where it ensures that selectedAccount in the AccountsController is
defined.

## **Related issues**

Fixes: #11866

## **Manual testing steps**

1. Run `main` and create a wallet with 3 accounts, select account 1
2. Kill the app and apply a migration that sets `selectedAccount` in the
AccountsController to undefined, re-run yarn watch and re-open app
3. Notice that the app is stuck on the splash screen
4. Kill the app and run this branch, which applies the migration that
fixes the issue. Notice that the app is now accessible again

## **Screenshots/Recordings**

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

### **Before**

<!-- [screenshots/recordings]  -->
<img width="900" alt="Screenshot 2024-10-30 at 4 42 44 PM"

src="https://github.com/user-attachments/assets/394f1b4c-741c-4c7f-993e-b0120e16588e">

<img width="961" alt="Screenshot 2024-10-30 at 4 43 07 PM"

src="https://github.com/user-attachments/assets/37c685b2-925a-45c5-a7c4-7fadec8cba6f">

### **After**

<!-- [screenshots/recordings] -->
App is accessible again
<img width="444" alt="Screenshot 2024-10-30 at 10 11 24 PM"

src="https://github.com/user-attachments/assets/cc0cb9ef-2a5b-4804-a9e8-eac93cc4212d">


## **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.
[dfcd8c8](dfcd8c8)

Co-authored-by: Cal Leung <cal.leung@consensys.net>
runway-github bot added a commit that referenced this issue Nov 1, 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 fixes #11866
where it ensures that selectedAccount in the AccountsController is
defined.

## **Related issues**

Fixes: #11866

## **Manual testing steps**

1. Run `main` and create a wallet with 3 accounts, select account 1
2. Kill the app and apply a migration that sets `selectedAccount` in the
AccountsController to undefined, re-run yarn watch and re-open app
3. Notice that the app is stuck on the splash screen
4. Kill the app and run this branch, which applies the migration that
fixes the issue. Notice that the app is now accessible again

## **Screenshots/Recordings**

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

### **Before**

<!-- [screenshots/recordings]  -->
<img width="900" alt="Screenshot 2024-10-30 at 4 42 44 PM"
src="https://github.com/user-attachments/assets/394f1b4c-741c-4c7f-993e-b0120e16588e">

<img width="961" alt="Screenshot 2024-10-30 at 4 43 07 PM"
src="https://github.com/user-attachments/assets/37c685b2-925a-45c5-a7c4-7fadec8cba6f">

### **After**

<!-- [screenshots/recordings] -->
App is accessible again
<img width="444" alt="Screenshot 2024-10-30 at 10 11 24 PM"
src="https://github.com/user-attachments/assets/cc0cb9ef-2a5b-4804-a9e8-eac93cc4212d">


## **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-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.
@sethkfman sethkfman added release-7.34.0 and removed release-7.35.0 Issue or pull request that will be included in release 7.35.0 labels Jan 15, 2025
@github-project-automation github-project-automation bot moved this to To be fixed in Bugs by team Jan 15, 2025
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.32.0 Regression bug that was found in production in release 7.32.0 release-7.34.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
Status: To be fixed
Development

Successfully merging a pull request may close this issue.

4 participants