nautechsystems/nautilus_trader · error

Call edge address is invalid

Error message

Call edge address is invalid

What it means

The caller field of a call edge must parse as a valid Ethereum address (via Address::from_str). If the string is malformed — wrong length, non-hex characters, missing 0x — the library maps the parse failure to this error. Unlike the pinning check, this fires before any contract-set lookup, so it is purely an address format problem.

Source

Thrown at crates/adapters/blockchain/src/rpc/verification.rs:1401

        anyhow::ensure!(
            pool.fee != 0 && pool.fee <= 1_000_000,
            "Pool fee is invalid"
        );
    }
    let mut call_edges = HashSet::new();
    for edge in &manifest.call_edges {
        anyhow::ensure!(
            matches!(
                edge.purpose.as_str(),
                "wrap" | "approve" | "swap_sell" | "swap_buy"
            ) && matches!(
                edge.call_type.as_str(),
                "call" | "staticcall" | "delegatecall" | "callcode"
            ),
            "Deployment manifest call edge is invalid"
        );
        let caller = Address::from_str(&edge.caller)
            .map_err(|_| anyhow::anyhow!("Call edge address is invalid"))?;
        let target = Address::from_str(&edge.target)
            .map_err(|_| anyhow::anyhow!("Call edge address is invalid"))?;
        for address in [caller, target] {
            anyhow::ensure!(
                contract_addresses.contains(&address),
                "Call edge references an unpinned contract"
            );
        }
        anyhow::ensure!(
            call_edges.insert((
                edge.purpose.as_str(),
                caller,
                target,
                edge.call_type.as_str()
            )),
            "Deployment manifest contains a duplicate call edge"
        );
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Replace edge.caller with the full 20-byte hex address (0x followed by 40 hex characters) of the calling contract
  2. Copy the address directly from the pinned contracts section rather than retyping it
  3. Resolve any ENS names/aliases to raw addresses before writing the manifest
  4. Validate all address strings with a hex/address parser before submitting the manifest

Example fix

// before
{"caller": "0xabc123", "target": "0xdef...", "purpose": "approve"}
// after
{"caller": "0xabc123def4567890abcdef1234567890abcdef12", "target": "0xdef...", "purpose": "approve"}
Defensive patterns

Strategy: validation

Validate before calling

fn valid_eth_address(s: &str) -> bool {
    s.len() == 42 && s.starts_with("0x") && s[2..].chars().all(|c| c.is_ascii_hexdigit())
}
for edge in &manifest.call_edges {
    if !valid_eth_address(&edge.caller) {
        return Err(format!("caller not a hex address: {}", edge.caller));
    }
}

Type guard

fn is_eth_address(s: &str) -> bool {
    s.len() == 42 && s.starts_with("0x") && s[2..].chars().all(|c| c.is_ascii_hexdigit())
}

Try / catch

match validate_deployment_manifest(&manifest) {
    Err(e) if e.to_string().contains("Call edge address is invalid") => {
        eprintln!("Use a full 0x-prefixed 40-hex-char address for edge.caller: {e}");
    }
    Err(e) => return Err(e),
    Ok(()) => {}
}

Prevention

When it happens

Trigger: Validating a manifest with a call edge whose caller is not a 20-byte hex address: empty string, truncated address, invalid characters, or a value accidentally holding a name or placeholder.

Common situations: Copy-paste truncation of an address; leaving a "<CALLER>" placeholder unfilled; mixing an ENS name or alias into a field that requires a raw hex address; editing JSON and dropping characters.

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