nautechsystems/nautilus_trader · error · anyhow::Error

Deployment manifest wrapped native contract does not match `

Error message

Deployment manifest wrapped native contract does not match `weth_address`

What it means

`validate_manifest_contracts` resolves the single `WrappedNative` role contract from the manifest and compares it to the `weth` address supplied in the client config. The `anyhow::ensure!` check fails when the manifest's wrapped-native address differs from the configured `weth_address`, blocking a client that would otherwise wrap/unwrap against the wrong token contract.

Source

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

                        .map_err(|_| anyhow::anyhow!("Deployment manifest address is invalid"))
                })
                .collect::<anyhow::Result<HashSet<_>>>()
        };
        let singleton = |role, description: &str| {
            let addresses = role_addresses(role)?;
            anyhow::ensure!(
                addresses.len() == 1,
                "Deployment manifest must contain exactly one {description} contract"
            );
            Ok(*addresses.iter().next().expect("singleton role address"))
        };

        let configured_routers = routers.iter().copied().collect::<HashSet<_>>();
        anyhow::ensure!(
            role_addresses(BlockchainContractRole::Router)? == configured_routers,
            "Deployment manifest router set does not match `router_addresses`"
        );
        anyhow::ensure!(
            singleton(BlockchainContractRole::WrappedNative, "wrapped native")? == weth,
            "Deployment manifest wrapped native contract does not match `weth_address`"
        );
        let factory = singleton(BlockchainContractRole::Factory, "factory")?;
        let registered_factory =
            crate::exchanges::get_dex_extended(config.chain.name, &DexType::UniswapV3)
                .map(|dex| dex.factory)
                .ok_or_else(|| {
                    anyhow::anyhow!(
                        "No registered Uniswap V3 deployment for chain {}",
                        config.chain.name
                    )
                })?;
        anyhow::ensure!(
            factory == registered_factory,
            "Deployment manifest factory does not match the registered Uniswap V3 factory"
        );
        let quote_contract = singleton(BlockchainContractRole::Quote, "quote")?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set the manifest's WrappedNative contract address equal to the configured `weth_address`
  2. Regenerate the deployment manifest for the target chain so wrapped native matches the canonical WETH/WMATIC/etc. address for that chain
  3. Update config `weth_address` if the manifest reflects the newer deployment

Example fix

// before
manifest: {"role": "WrappedNative", "address": "0xOLD..."}; config weth_address: 0xNEW...
// after
manifest: {"role": "WrappedNative", "address": "0xNEW..."}; config weth_address: 0xNEW...
Defensive patterns

Strategy: validation

Validate before calling

let manifest_weth = manifest.contracts.iter()
    .find(|c| c.role == BlockchainContractRole::WrappedNative)
    .map(|c| Address::from_str(&c.address));
assert_eq!(manifest_weth.transpose().ok().flatten(), Some(config.weth_address), "weth mismatch");

Prevention

When it happens

Trigger: Client initialization where the manifest's `WrappedNative` singleton address != the `weth` argument (typically from config's `weth_address`), e.g. after changing config for a new chain while reusing an old manifest.

Common situations: Switching chains (e.g. mainnet to Arbitrum) and updating `weth_address` in config but not the manifest; deploying a new wrapped-native token and updating only one of the two sources; copy-pasting the wrong token address into either the manifest or config.

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/fd836320d97fc079. Report an issue: GitHub.