nautechsystems/nautilus_trader · error · anyhow::Error

Deployment manifest token address is invalid

Error message

Deployment manifest token address is invalid

What it means

While building the manifest's token table, `validate_manifest_contracts` parses each `manifest.tokens[].address` with `Address::from_str` and maps any parse failure to this error. Every token listed in the deployment manifest must be a well-formed Ethereum address, since these addresses key the `token_decimals` map used for amount handling.

Source

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

            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")?;

        let mut token_decimals = HashMap::new();

        for token in &manifest.tokens {
            let address = Address::from_str(&token.address)
                .map_err(|_| anyhow::anyhow!("Deployment manifest token address is invalid"))?;
            anyhow::ensure!(
                token_decimals.insert(address, token.decimals).is_none(),
                "Deployment manifest contains a duplicate token identity"
            );
        }
        anyhow::ensure!(
            token_decimals.contains_key(&weth),
            "Deployment manifest has no wrapped native token identity"
        );

        if let Some(tokens) = &config.tokens {
            for token in tokens {
                let address = validate_address(token)?;
                anyhow::ensure!(
                    token_decimals.contains_key(&address),
                    "Configured token {address} has no deployment manifest identity"
                );
            }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Fix the malformed token `address` in the deployment manifest to a valid 0x-prefixed 40-hex-char address
  2. Regenerate the manifest's token list from the chain's authoritative token registry
  3. Pre-validate all token addresses with `Address::from_str` before loading the manifest

Example fix

// before
{"symbol": "USDC", "address": "0xA0b86991..."}  // truncated
// after
{"symbol": "USDC", "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"}
Defensive patterns

Strategy: validation

Validate before calling

for t in &manifest.tokens {
    Address::from_str(&t.address).map_err(|e| format!("token {} has invalid address: {e}", t.symbol))?;
}

Type guard

fn is_valid_address(s: &str) -> bool { Address::from_str(s).is_ok() }

Prevention

When it happens

Trigger: Client validation where any entry in `manifest.tokens` has an `address` string that fails `Address::from_str`: empty, missing `0x`, wrong hex length, invalid characters, or bad checksum.

Common situations: Manually adding a token row to the manifest with a typo; pasting a symbol or name into the address field; truncating an address when copying from a block explorer; addresses exported from another tool in a non-hex format.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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