{"record":{"id":"ffd2d67c3383a179","repo":"nautechsystems/nautilus_trader","slug":"invalid-dex-name-case-insensitive-supporte-ffd2d6","errorCode":null,"errorMessage":"Invalid DEX name '{}' (case-insensitive). Supported DEXes for chain '{}': {}","messagePattern":"Invalid DEX name '(.+?)' \\(case-insensitive\\)\\. Supported DEXes for chain '(.+?)': (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/sync.rs","lineNumber":46,"sourceCode":"use crate::opt::DatabaseConfig;\n\npub(crate) async fn run_sync_dex(\n    chain: String,\n    dex: String,\n    rpc_url: Option<String>,\n    database: DatabaseConfig,\n    reset: bool,\n    multicall_calls_per_rpc_request: Option<u32>,\n) -> anyhow::Result<()> {\n    let chain = Chain::from_chain_name(&chain)\n        .ok_or_else(|| anyhow::anyhow!(\"Invalid chain name: {chain}\"))?;\n\n    let dex_type = find_dex_type_case_insensitive(&dex, chain).ok_or_else(|| {\n        let supported_dexes = get_supported_dexes_for_chain(chain.name);\n        if supported_dexes.is_empty() {\n            anyhow::anyhow!(\"Invalid DEX name '{}' (case-insensitive). Chain '{}' is not supported for pool syncing.\",dex, chain.name)\n        } else {\n            anyhow::anyhow!(\"Invalid DEX name '{}' (case-insensitive). Supported DEXes for chain '{}': {}\",dex,chain.name,supported_dexes.join(\", \"))\n        }\n    })?;\n\n    // Fail before connecting to the RPC/database when the DEX cannot discover pools from\n    // PoolCreated logs; without a parser sync-dex would otherwise find zero pools silently.\n    let dex_extended = get_dex_extended(chain.name, &dex_type).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"DEX '{dex_type}' is not registered on chain '{}'\",\n            chain.name\n        )\n    })?;\n\n    if !dex_extended.supports_pool_discovery() {\n        anyhow::bail!(\n            \"DEX '{dex_type}' on chain '{}' cannot be synced: missing a PoolCreated parser for pool discovery.\",\n            chain.name\n        );\n    }","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/sync.rs#L28-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use one of the DEX names listed in the error message (case-insensitive).","Fix the spelling/variant to the canonical registry name.","Query get_supported_dexes_for_chain(chain.name) programmatically to confirm valid names.","Register the DEX for the chain in the registry if it should be supported."],"exampleFix":"// before\nnautilusctl blockchain sync-dex --chain base --dex aerodrome-finance\n// after\nnautilusctl blockchain sync-dex --chain base --dex aerodrome","handlingStrategy":"validation","validationCode":"let supported = get_supported_dexes_for_chain(chain.name);\nif !supported.iter().any(|d| d.eq_ignore_ascii_case(dex)) {\n    eprintln!(\"valid: {}\", supported.join(\", \"));\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact registry DEX names; do not add spaces or informal aliases.","Recheck names after upgrades that may rename DEX variants.","Enumerate supported DEXes per chain in a preflight script.","Store validated chain+DEX pairs as constants in automation."],"tags":["cli","validation","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}