{"record":{"id":"cd573fc6daa0cd70","repo":"nautechsystems/nautilus_trader","slug":"invalid-dex-name-case-insensitive-supporte","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":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/analyze.rs","lineNumber":514,"sourceCode":"    data_client.initialize_cache_database().await;\n    data_client.cache.initialize_chain().await;\n\n    Ok(data_client)\n}\n\nfn parse_chain_dex(chain: &str, dex: &str) -> anyhow::Result<(Chain, DexType)> {\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!(\n                \"Invalid DEX name '{}' (case-insensitive). Chain '{}' is not supported for pool analysis.\",\n                dex, chain.name\n            )\n        } else {\n            anyhow::anyhow!(\n                \"Invalid DEX name '{}' (case-insensitive). Supported DEXes for chain '{}': {}\",\n                dex,\n                chain.name,\n                supported_dexes.join(\", \")\n            )\n        }\n    })?;\n\n    ensure_pool_analysis_supported(chain, dex_type)?;\n\n    Ok((chain.to_owned(), dex_type))\n}\n\n// A DEX can be registered for discovery yet lack the analysis parsers; fail here instead of\n// syncing and only failing deep inside profiling.\nfn ensure_pool_analysis_supported(chain: &Chain, dex_type: DexType) -> anyhow::Result<()> {\n    let dex_extended = get_dex_extended(chain.name, &dex_type).ok_or_else(|| {\n        anyhow::anyhow!(","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/analyze.rs#L496-L532","documentation":"Thrown by parse_chain_dex when the --dex argument does not match any DEX registered for the given chain, but the chain itself IS supported for pool analysis. The message enumerates the valid DEX names so the user can pick a correct one.","triggerScenarios":"Running `run_analyze_pool` or `run_analyze_pools` with a DEX name that fails find_dex_type_case_insensitive(dex, chain) while get_supported_dexes_for_chain(chain.name) is non-empty; the join of supported names is included in the message.","commonSituations":"Misspelling a DEX name ('uniswapv3' vs 'uniswap-v3'); using a DEX that exists on another chain but is not registered on the selected one; stale documentation/scripts referencing a renamed DEX.","solutions":["Use one of the DEX names listed in the error message (matching is case-insensitive).","List supported DEXes programmatically with get_supported_dexes_for_chain(chain.name) before invoking.","Fix the spelling/variant of the DEX name to the canonical registry entry.","If the DEX should be supported, register it for the chain in the DEX extended registry."],"exampleFix":"// before\nnautilusctl blockchain analyze-pool --chain ethereum --dex uni-v2\n// after\nnautilusctl blockchain analyze-pool --chain ethereum --dex uniswap-v2","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 dexes for {}: {}\", chain.name, supported.join(\", \"));\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always cross-check the DEX name against the supported list for the specific chain (names differ per chain).","Rely on case-insensitive matching but not on fuzzy matching; use exact registry names.","Regenerate scripts after DEX renames instead of reusing old names.","Catch this anyhow error at the CLI boundary and print the supported list already embedded in the message."],"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"}