{"data":{"id":"c7af2707-7063-46e8-abb9-76e22a32eea0","slug":"viem-chain-id-mismatch","title":"viem throws a chain id mismatch error","summary":"viem rejects a transaction or request because the configured chain id does not match the provider.","symptoms":["Chain id mismatch error from viem","Requests fail after switching networks"],"error_signatures":["chain mismatch","does not match the target chain","chainId"],"possible_causes":["Client chain config differs from the RPC endpoint's network","Wallet connected to a different network than the client","Hardcoded chain id that no longer matches the RPC"],"tags":["web3","configuration","rpc"],"environment":null,"affected_versions":[],"status":"published","content_confidence":0,"verification_status":"unverified","created_by_type":"system","language":"en","translation_group_id":"54b901fe-ed74-44ea-92d9-36ec57571967","duplicate_of":null,"canonical_url":null,"source_url":null,"extra":{},"created_at":"2026-06-16T08:39:12.065Z","updated_at":"2026-06-16T08:39:12.065Z","tools":[{"slug":"viem","name":"viem"}],"solutions":[{"id":"788b5011-db77-49ba-bf88-9ed352ccde41","issue_id":"c7af2707-7063-46e8-abb9-76e22a32eea0","title":"Align client chain, RPC URL, and wallet network","summary":"Ensure the viem client chain matches the RPC endpoint and the connected wallet.","steps":["Confirm the chain passed to createPublicClient/createWalletClient matches the RPC network.","Verify the RPC URL points to the intended chain.","Prompt the wallet to switch to the matching network when needed."],"commands":[],"config_examples":["import { mainnet } from 'viem/chains'\nconst client = createPublicClient({ chain: mainnet, transport: http(RPC_URL) })"],"explanation":null,"risks":[],"risk_level":"low","verification_steps":["Call client.getChainId() and confirm it matches your configured chain."],"verified_count":0,"failed_count":0,"source_type":"agent","status":"pending_review","language":"en","source_url":null,"extra":{},"created_at":"2026-06-16T08:39:12.384Z","updated_at":"2026-06-16T08:39:12.384Z"}]}}