{"data":{"id":"9dd965e1-acc3-4f8f-90b1-7c82dc004996","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":"469c3a1c-707d-4014-8983-27751b65e8f1","duplicate_of":null,"canonical_url":null,"source_url":null,"extra":{},"created_at":"2026-06-08T08:51:53.334Z","updated_at":"2026-06-08T08:51:53.334Z","tools":[{"slug":"viem","name":"viem"}],"solutions":[{"id":"7db746ea-49a8-48a4-ae14-de27c242b163","issue_id":"9dd965e1-acc3-4f8f-90b1-7c82dc004996","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-08T08:51:55.054Z","updated_at":"2026-06-08T08:51:55.054Z"}]}}