nautechsystems/nautilus_trader · error · anyhow::Error

Deployment manifest address is invalid

Error message

Deployment manifest address is invalid

What it means

This error is thrown by `validate_manifest_contracts` when a contract address in the deployment manifest cannot be parsed into an `alloy_primitives::Address` via `Address::from_str`. The library requires all manifest contract addresses to be well-formed 20-byte Ethereum addresses (typically 0x-prefixed hex, checksum-sensitive for `Address::from_str` which requires exactly 40 hex chars). It aborts validation early so a malformed manifest never reaches contract binding.

Source

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

    }

    fn validate_manifest_contracts(
        config: &BlockchainExecutionClientConfig,
        routers: &[Address],
        weth: Address,
    ) -> anyhow::Result<()> {
        let verification = config.verification.as_ref().ok_or_else(|| {
            anyhow::anyhow!("Independent Blockchain execution verification is required")
        })?;
        let manifest = &verification.deployment_manifest;
        let role_addresses = |role| {
            manifest
                .contracts
                .iter()
                .filter(|contract| contract.role == role)
                .map(|contract| {
                    Address::from_str(&contract.address)
                        .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!(

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Open the deployment manifest and fix the malformed `contracts[].address` so it is a valid 0x-prefixed 40-hex-character Ethereum address
  2. Regenerate the deployment manifest from the authoritative deployment output instead of hand-editing it
  3. Validate every address with `Address::from_str` (or a checksum tool) before loading the manifest

Example fix

// before (manifest.contracts)
{"role": "Router", "address": "0xabc123"}
// after
{"role": "Router", "address": "0xE592427A0AEce92De3Edee1F18E0157C05861564"}
Defensive patterns

Strategy: validation

Validate before calling

use alloy_primitives::Address;
use std::str::FromStr;
fn valid_manifest_addresses(contracts: &[ContractEntry]) -> Result<(), String> {
    for c in contracts {
        Address::from_str(&c.address).map_err(|e| format!("invalid contract address {:?}: {e}", c.address))?;
    }
    Ok(())
}

Type guard

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

Prevention

When it happens

Trigger: Calling the client initialization path that runs `validate_manifest_contracts` (e.g. building the blockchain execution client from a deployment manifest) where any entry in `manifest.contracts` has an `address` string that `Address::from_str` rejects: empty string, missing `0x` prefix, wrong length, non-hex characters, or wrong checksum casing.

Common situations: Hand-edited deployment manifest JSON with a typo in a contract address; copying an address from a different chain's deployment; truncating or padding an address; using a placeholder like `<ROUTER_ADDRESS>`; addresses stored without the 0x prefix or with EIP-55 checksum case mixed incorrectly.

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