MetaMask / MetaMask/metamask-extension
[Bug]: Background - Terminate service worker and try to login to the wallet: `Cannot call write after a stream was destroyed`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
Describe the bug
If you terminate service worker and then try to login to the wallet, without refreshing you get the: Cannot call write after a stream was destroyed error in the UI and cannot login.
You can work around the issue just by refreshing the browser, so it's not severe. However, reporting in case this needs to be investitgated further in the context of the infinite loading issues, or if there are Sentry issues which are just that.
This is error appears on the console when you terminate the service worker: Error#1: PortDuplexStream - disconnected
Expected behavior
No response
Screenshots/Recordings
https://github.com/user-attachments/assets/818b6b94-3d79-4932-8421-47e0a30b96ec
Steps to reproduce
- Open MetaMask in full view and log in
- Open a new tab and go to chrome://serviceworker-internals/?devtools
- Look for the MM extension Id
- Click Stop on the service worker for your extension
- Go to MetaMask tab
- Without refreshing, lock it
- Try to unlock it
- See error
(same happens if you try to reveal the priv key )
Error messages or log output
Detection stage
In production (default)
Version
13.1.2
Build type
None
Browser
Chrome
Operating system
Linux
Hardware wallet
No response
Additional context
No response
Severity
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the service-worker termination and wallet unlock steps in Chrome, then trace the PortDuplexStream - disconnected and Cannot call write after a stream was destroyed errors. Done means locking, unlocking, and revealing the private key work without refreshing after the service worker is stopped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100