{"record":{"id":"3594495bc91a28ae","repo":"nautechsystems/nautilus_trader","slug":"invalid-chain-name-chain-359449","errorCode":null,"errorMessage":"Invalid chain name: {chain}","messagePattern":"Invalid chain name: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/blockchain/sync.rs","lineNumber":39,"sourceCode":"    exchanges::{find_dex_type_case_insensitive, get_dex_extended, get_supported_dexes_for_chain},\n    rpc::providers::check_infura_rpc_provider,\n};\nuse nautilus_core::string::secret::mask_api_key;\nuse nautilus_infrastructure::sql::pg::get_postgres_connect_options;\nuse nautilus_model::defi::chain::Chain;\n\nuse 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    })?;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/cli/src/blockchain/sync.rs#L21-L57","documentation":"Thrown by run_sync_dex when the --chain argument cannot be resolved to a Chain via Chain::from_chain_name. Syncing cannot proceed without a known chain; this check runs before DEX resolution and any RPC/database connection.","triggerScenarios":"Calling run_blockchain_command -> run_sync_dex with a chain string that is not in the Chain::from_chain_name lookup (misspelled, wrong casing if matching is case-sensitive, or an unsupported/custom chain id).","commonSituations":"Typing 'eth' or 'ethereum-mainnet' instead of the canonical name; using an internal alias not in the registry; typos like 'etherum'; running against a chain this build does not know.","solutions":["Use a canonical chain name recognized by Chain::from_chain_name (e.g. 'ethereum', 'base', 'arbitrum').","Check CLI help or the Chain registry for the exact accepted names.","Fix the spelling/casing of the --chain argument.","If the chain must be supported, add it to the Chain lookup table."],"exampleFix":"// before\nnautilusctl blockchain sync-dex --chain eth --dex uniswap-v2\n// after\nnautilusctl blockchain sync-dex --chain ethereum --dex uniswap-v2","handlingStrategy":"validation","validationCode":"if let None = Chain::from_chain_name(&chain_arg) {\n    eprintln!(\"unknown chain '{}'; use a canonical name like ethereum, base, arbitrum\", chain_arg);\n    std::process::exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use canonical chain names from the Chain registry, not colloquial aliases.","Shell-complete the --chain value instead of typing it.","Centralize chain names in deployment scripts/config constants.","Check Chain::from_chain_name in a dry-run before wiring new chains into 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"}