nautechsystems/nautilus_trader · critical · anyhow::Error

Verification chain anchor ID does not match the configured c

Error message

Verification chain anchor ID does not match the configured chain

What it means

Thrown by `BlockchainExecutionClient::new` via `anyhow::ensure!` when `verification.chain_anchor.chain_id` differs from `config.chain.chain_id`. The verification coordinator must verify executions on exactly the chain the client transacts on; a mismatch means the config points at two different networks.

Source

Thrown at crates/adapters/blockchain/src/execution/client.rs:187

        core_client: ExecutionClientCore,
        config: BlockchainExecutionClientConfig,
    ) -> anyhow::Result<Self> {
        let transaction_limits = Self::transaction_limits(&config)?;
        let chain = Arc::new(config.chain.clone());
        let cache = BlockchainCache::new(chain.clone());
        let http_rpc_client = Arc::new(BlockchainHttpRpcClient::new(
            config.http_rpc_url.clone().into_inner(),
            config.rpc_requests_per_second,
            None,
        ));
        let verification_config = config.verification.as_ref().ok_or_else(|| {
            anyhow::anyhow!("Independent Blockchain execution verification is required")
        })?;
        anyhow::ensure!(
            verification_config.chain_anchor.chain_id == config.chain.chain_id,
            "Verification chain anchor ID does not match the configured chain"
        );
        anyhow::ensure!(
            verification_config.chain_anchor.chain_name == config.chain.name.to_string(),
            "Verification chain anchor name does not match the configured chain"
        );
        let verification = VerificationCoordinator::new(
            http_rpc_client.clone(),
            config.http_rpc_url.expose_secret(),
            verification_config,
            config.rpc_requests_per_second,
        )?;
        let wallet_address = validate_address(config.wallet_address.as_str())?;
        let erc20_contract = Erc20Contract::new_with_timeout(
            http_rpc_client.clone(),
            Some(EXECUTION_RPC_TIMEOUT_SECS),
            true,
        );

        let router_addresses = config
            .router_addresses

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set `verification.chain_anchor.chain_id` equal to `config.chain.chain_id` in the config file.
  2. If the deployment target changed, regenerate the deployment manifest for the correct chain and update the anchor.
  3. Load both values from a single shared chain descriptor so they cannot drift.

Example fix

// before (config.toml)
[chain]
chain_id = 8453
[verification.chain_anchor]
chain_id = 1
// after
[chain]
chain_id = 8453
[verification.chain_anchor]
chain_id = 8453
Defensive patterns

Strategy: validation

Validate before calling

fn chain_ids_match(config: &BlockchainExecutionClientConfig) -> bool {
    config.verification.as_ref()
        .map(|v| v.chain_anchor.chain_id == config.chain.chain_id)
        .unwrap_or(false)
}

Try / catch

BlockchainExecutionClient::new(config.clone()).map_err(|e| {
    if e.to_string().contains("chain anchor ID") {
        anyhow::anyhow!("verification.chain_anchor.chain_id must equal chain.chain_id ({})", config.chain.chain_id)
    } else { e }
})?;

Prevention

When it happens

Trigger: Constructing a `BlockchainExecutionClient` where the `verification` section's `chain_anchor.chain_id` (e.g. 1 for Ethereum mainnet) does not equal the client's `chain.chain_id` (e.g. 8453 for Base) — typically after copying a config between environments and editing only one side.

Common situations: Reusing a mainnet verification manifest/config against a testnet chain (or vice versa); renaming/chains changed by a fork; hand-editing chain IDs in one section only.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/a4c1ec30abcf876b. Report an issue: GitHub.