nautechsystems/nautilus_trader · error

Chain anchor name is required

Error message

Chain anchor name is required

What it means

`validate_config` requires `config.chain_anchor.chain_name` to be a non-empty, non-whitespace-only string, checked with `!anchor.chain_name.trim().is_empty()`. The chain name is used for human-readable identification of the anchored chain, and an empty name indicates a misconfigured anchor. The error is thrown when the field is empty or contains only whitespace.

Source

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

                identities[right]
                    .failure_domain_ids
                    .iter()
                    .all(|domain| !left_domains.contains(domain)),
                "Provider failure domains must be pairwise disjoint"
            );
        }
    }

    let endpoints = [
        normalize_endpoint(authoritative_url)?,
        normalize_endpoint(config.verifiers[0].http_rpc_url.expose_secret())?,
        normalize_endpoint(config.verifiers[1].http_rpc_url.expose_secret())?,
    ];
    ensure_distinct(endpoints.iter().map(String::as_str), "provider endpoints")?;

    let anchor = &config.chain_anchor;
    anyhow::ensure!(anchor.chain_id != 0, "Chain anchor ID must be nonzero");
    anyhow::ensure!(
        !anchor.chain_name.trim().is_empty(),
        "Chain anchor name is required"
    );
    let checkpoint_hash = B256::from_str(&anchor.checkpoint_hash)
        .map_err(|_| anyhow::anyhow!("Chain checkpoint hash must contain 32 hexadecimal bytes"))?;
    anyhow::ensure!(
        checkpoint_hash != B256::ZERO,
        "Chain checkpoint hash must be nonzero"
    );
    anyhow::ensure!(
        anchor.max_head_skew_blocks != 0
            && anchor.max_head_age_secs != 0
            && anchor.max_future_drift_secs != 0,
        "Chain head skew, age, and future-drift limits must be nonzero"
    );
    anyhow::ensure!(
        !config.manifest_version.trim().is_empty(),
        "Deployment manifest version is required"

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set `chain_anchor.chain_name` to the network's canonical name (e.g. "mainnet", "sepolia").
  2. Check that env-var interpolation for the name actually resolves to a non-empty value.
  3. Verify the exact key spelling (`chain_name`) in the config file so it is not silently defaulted.
  4. Trim/validate the value at config-generation time to reject whitespace-only names.

Example fix

// before
[verification.chain_anchor]
chain_name = ""

// after
[verification.chain_anchor]
chain_name = "mainnet"
Defensive patterns

Strategy: validation

Validate before calling

fn check_chain_name(anchor: &ChainAnchor) -> Result<(), String> {
    if anchor.chain_name.trim().is_empty() {
        return Err("chain_anchor.chain_name is required and must be non-blank".into());
    }
    Ok(())
}

Type guard

fn has_chain_name(anchor: &ChainAnchor) -> bool {
    !anchor.chain_name.trim().is_empty()
}

Try / catch

match validate_config(&cfg) {
    Err(e) if e.to_string().contains("Chain anchor name is required") => {
        eprintln!("chain_anchor.chain_name missing or blank: {e}");
        std::process::exit(1);
    }
    other => other,
}

Prevention

When it happens

Trigger: Loading a verification config where `verification.chain_anchor.chain_name` is missing, set to "", or set to whitespace like " ".

Common situations: Config templates left unfilled; environment-variable substitution failing and yielding an empty string; YAML/TOML key typo so the value defaults to empty; automated config generation emitting an empty field.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — 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/6b534868a79f4899. Report an issue: GitHub.