MetaMask / MetaMask/metamask-extension
[Bug]: `Unchecked runtime.lastError: The page keeping the extension port is moved into back/forward cache, so the message channel is closed.`
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
### Describe the bug
I was switching back and forth between different browser tabs and I got this error in the console `Unchecked runtime.lastError: The page keeping the extension port is moved into back/forward cache, so the message channel is closed.`.
It doesn't seem to have any user facing impact.
### Expected behavior
_No response_
### Screenshots/Recordings

Here a video with the reproduction, though it doesn't seem to happen always
https://github.com/user-attachments/assets/fd7190e3-392c-4b0c-beba-0aedd663baaa
### Steps to reproduce
Hard to define, but roughly
- open several browser tabs
- connect to a couple of dapps
- switch between tabs
- see console error in the service worker
### Error messages or log output
_No response_
### Detection stage
In production (default)
### Version
12.1.1
### 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 issue using the listed Chrome tab-switching steps and observe the service worker console. Investigate the extension behavior around dapps, multiple tabs, and back/forward cache; done means determining whether the error can be prevented or safely handled without user-facing impact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100