nautechsystems/nautilus_trader · error · anyhow::Error

Invalid DEX name '{}' (case-insensitive). Supported DEXes fo

Error message

Invalid DEX name '{}' (case-insensitive). Supported DEXes for chain '{}': {}

What it means

CLI validation in run_sync_dex: the DEX name given on the command line does not match (case-insensitively) any DEX supported for the target chain; the message lists the supported DEXes for that chain.

Source

Thrown at crates/cli/src/blockchain/sync.rs:46

use crate::opt::DatabaseConfig;

pub(crate) async fn run_sync_dex(
    chain: String,
    dex: String,
    rpc_url: Option<String>,
    database: DatabaseConfig,
    reset: bool,
    multicall_calls_per_rpc_request: Option<u32>,
) -> anyhow::Result<()> {
    let chain = Chain::from_chain_name(&chain)
        .ok_or_else(|| anyhow::anyhow!("Invalid chain name: {chain}"))?;

    let dex_type = find_dex_type_case_insensitive(&dex, chain).ok_or_else(|| {
        let supported_dexes = get_supported_dexes_for_chain(chain.name);
        if supported_dexes.is_empty() {
            anyhow::anyhow!("Invalid DEX name '{}' (case-insensitive). Chain '{}' is not supported for pool syncing.",dex, chain.name)
        } else {
            anyhow::anyhow!("Invalid DEX name '{}' (case-insensitive). Supported DEXes for chain '{}': {}",dex,chain.name,supported_dexes.join(", "))
        }
    })?;

    // Fail before connecting to the RPC/database when the DEX cannot discover pools from
    // PoolCreated logs; without a parser sync-dex would otherwise find zero pools silently.
    let dex_extended = get_dex_extended(chain.name, &dex_type).ok_or_else(|| {
        anyhow::anyhow!(
            "DEX '{dex_type}' is not registered on chain '{}'",
            chain.name
        )
    })?;

    if !dex_extended.supports_pool_discovery() {
        anyhow::bail!(
            "DEX '{dex_type}' on chain '{}' cannot be synced: missing a PoolCreated parser for pool discovery.",
            chain.name
        );
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use one of the DEX names listed in the error message (case-insensitive).
  2. Fix the spelling/variant to the canonical registry name.
  3. Query get_supported_dexes_for_chain(chain.name) programmatically to confirm valid names.
  4. Register the DEX for the chain in the registry if it should be supported.

Example fix

// before
nautilusctl blockchain sync-dex --chain base --dex aerodrome-finance
// after
nautilusctl blockchain sync-dex --chain base --dex aerodrome
Defensive patterns

Strategy: validation

Validate before calling

let supported = get_supported_dexes_for_chain(chain.name);
if !supported.iter().any(|d| d.eq_ignore_ascii_case(dex)) {
    eprintln!("valid: {}", supported.join(", "));
    std::process::exit(2);
}

Prevention

When it happens

Trigger: run_blockchain_command -> run_sync_dex with a --dex value failing find_dex_type_case_insensitive while get_supported_dexes_for_chain(chain.name) is non-empty; supported names are joined into the message.

Common situations: Misspelling ('uniswap v3' with a space); using a DEX from another chain; renamed DEX variants between versions (e.g. 'sushiswap' vs 'sushiswap-v2'); stale scripts.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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