Skip to content

bug: wallet_switchEthereumChain fails silently for Arc Testnet in MetaMask — wallet_addEthereumChain must be used unconditionally #89

@osr21

Description

@osr21

Summary

In MetaMask, calling wallet_switchEthereumChain for Arc Testnet (Chain ID 0x4CEF52 / 5042002) fails silently or throws an unhandled error — even when the network was previously added. The only reliable method is wallet_addEthereumChain, which both adds the network if missing and switches to it if already present.

Steps to reproduce

  1. Add Arc Testnet to MetaMask manually or via a previous wallet_addEthereumChain call
  2. Switch to a different network (e.g. Ethereum Mainnet)
  3. Call:
    await window.ethereum.request({
      method: "wallet_switchEthereumChain",
      params: [{ chainId: "0x4CEF52" }],
    });
  4. MetaMask either throws 4902 (chain not found) or silently does nothing — the switch does not occur

Workaround

Always use wallet_addEthereumChain regardless of whether the user has already added Arc Testnet:

await window.ethereum.request({
  method: "wallet_addEthereumChain",
  params: [{
    chainId: "0x4CEF52",
    chainName: "Arc Testnet",
    nativeCurrency: { name: "ETH", symbol: "ETH", decimals: 18 },
    rpcUrls: ["https://rpc.testnet.arc.network"],
    blockExplorerUrls: ["https://testnet.arcscan.app"],
  }],
});

This works reliably as both an add and a switch operation.

Environment

  • MetaMask browser extension (latest)
  • Arc Testnet Chain ID: 5042002 (0x4CEF52)
  • Observed in Chrome and Brave browsers, May 2025

Impact

All Arc Testnet DApp onboarding flows that use wallet_switchEthereumChain will silently fail to switch the user to the correct network. This is a significant UX issue for new users.

Suggested fix / docs update

Document that wallet_addEthereumChain is the correct and only reliable method for switching users to Arc Testnet, and remove any references to wallet_switchEthereumChain from Arc developer guides.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions