Files
proxmox/docs/09-troubleshooting/DAPP_CONSOLE_ERRORS_METAMASK.md

43 lines
2.3 KiB
Markdown
Raw Normal View History

# DApp Console Errors — MetaMask (ObjectMultiplex / StreamMiddleware)
**Last updated:** 2026-02-22
## What you might see
In the browser console when using the DApp with MetaMask you may see:
- **ObjectMultiplex - malformed chunk without name "ACK"**
- **StreamMiddleware - Unknown response id "…"**
- **MetaMask: Lost connection to "MetaMask RpcProvider"**
- **MetaMask: Disconnected from MetaMask background. Page reload required.**
These messages come from **MetaMasks inpage script** (`inpage.js`) and the extensions internal stream protocol, not from the DApps application code.
## Cause
- The **ObjectMultiplex** and **StreamMiddleware** messages are from the extensions JSON-RPC stream (page ↔ MetaMask background). They can appear when:
- The extension is updated or restarted
- The tab is backgrounded for a long time
- Multiple wallet extensions (e.g. MetaMask + MetaMask Flask) are installed
- The browser or extension has a temporary glitch
- **“Lost connection” / “Disconnected from MetaMask background”** means the content script lost its connection to the extensions background page (e.g. user locked MetaMask, restarted the extension, or the extension crashed).
## What we did in the DApp
- **We cannot fix or suppress these errors inside the DApp** — they are emitted by the MetaMask extension.
- We added **user-facing handling** so that when the wallet disconnects unexpectedly, the DApp shows a toast:
**“Wallet disconnected. Please reconnect or reload the page.”**
This does not show when the user explicitly clicks **Disconnect** in the DApp.
## What you can do
1. **Reload the page** after a “Lost connection” error, then click **Connect Wallet** again.
2. **Use a single MetaMask build** (e.g. disable MetaMask Flask if you dont need it) to reduce stream conflicts.
3. **Update MetaMask** to the latest version.
4. **Ignore the ObjectMultiplex/StreamMiddleware messages** if the DApp still connects and works after a reload.
## References
- MetaMask inpage provider: content script that injects `window.ethereum` and uses a multiplexed stream to the background page.
- Wagmi/viem in the DApp use this provider; when the extension drops the connection, wagmis `useAccount()` eventually reports `isConnected: false`, which we use to show the disconnect toast.