MetaMask / MetaMask/metamask-extension

(Ext) [Bug]: Removing selected account while doing a tx throws "Cannot destructure property 'balance' of 'ee[z]' as it is undefined."

Open
#14,938 6 comments 0 reactions 0 assignees View on GitHub
Bugs---Low-Priority extension INVALID-ISSUE-TEMPLATE Sev3-low team-confirmations type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

**Describe the bug**

**Problem**: when I'm in the middle of a transaction and I interrupt it by removing the selected account, I land on the Metamask error page with the TypeError: `Cannot destructure property 'balance' of 'ee[z]' as it is undefined.`

![image](https://user-images.githubusercontent.com/54408225/173533245-0227ca9e-fa5b-49b5-9d1b-2fdb24565291.png)

**Steps to reproduce**

1. Unlock Metamask
2. Open Full view on a browser tab
3. Import an Account (i.e. Import Ledger account)
4. On a new tab go to [Test Dapp](https://metamask.github.io/test-dapp/)
5. Connect Metamask
6. Click Send Tx - the MM notification view will open (do not perform any action)
7. Change to MM full view tab
8. Click Account Details
9. Remove account
10. See Error on Notification view - you can refresh full view and the error will also appear there

https://user-images.githubusercontent.com/54408225/173534468-3b97c1be-0008-4a9d-b6a1-1d1a0238148a.mp4

**Error messages or log output**

```shell
Cannot destructure property 'balance' of 'ee[z]' as it is undefined.
```

**Version**

10.16.0

**Browser**

Chrome

**Operating system**

Linux

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the listed Full view, notification view, imported account, and Test Dapp transaction steps. Trace what happens when the selected account is removed while the transaction is pending; done means both views handle the removed account without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.