Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- Config, docs, scripts, and backup manifests - Submodule refs unchanged (m = modified content in submodules) Made-with: Cursor
43 lines
2.3 KiB
Markdown
43 lines
2.3 KiB
Markdown
# 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 **MetaMask’s inpage script** (`inpage.js`) and the extension’s internal stream protocol, not from the DApp’s application code.
|
||
|
||
## Cause
|
||
|
||
- The **ObjectMultiplex** and **StreamMiddleware** messages are from the extension’s 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 extension’s 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 don’t 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, wagmi’s `useAccount()` eventually reports `isConnected: false`, which we use to show the disconnect toast.
|