MetaMask / MetaMask/metamask-extension
[Bug]: Encrypt - Having a pending Decrypt request, and triggering`eth_getEncryptionPublicKey`, MetaMask breaks with the error `Cannot read properties of undefined (reading 'charAt')`
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
MetaMask breaks with the error `Cannot read properties of undefined (reading 'charAt')` when clicking Get Encryption Key while having a Decrypt request pending.
Note: in production, MM also breaks, but the error is different, it's: `Cannot read properties of undefined (reading 'balance')`. [This was the ticket for this error](https://github.com/MetaMask/metamask-extension/issues/23344) (which happens in prod 12.5.0)
### Expected behavior
_No response_
### Screenshots/Recordings

https://github.com/user-attachments/assets/94485758-de5a-4a99-819e-c4c4a905e5c0
### Steps to reproduce
1. Go to the test dapp
2. Connect
3. Click Get Encryption Key
4. Accept in MM
5. Add a message and click Encrypt
6. Click Decrypt, without accepting/rejecting in MM
7. Click Get Encryption Key
8. Click Decrypt
9. See MM breaks with error `Cannot read properties of undefined (reading 'charAt')`
### Error messages or log output
_No response_
### Detection stage
During release testing
### Version
12.6.0
### Build type
None
### Browser
Chrome
### Operating system
Linux
### Hardware wallet
_No response_
### Additional context
_No response_
### Severity
_No response_
Contributor guide
Research direction
Start by reproducing the sequence in the test dapp with MetaMask 12.6.0: leave a Decrypt request pending, then trigger eth_getEncryptionPublicKey and another Decrypt request. Trace the UI path handling these concurrent requests and verify that requesting the encryption key no longer breaks MetaMask with an undefined-property error.
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