{"record":{"id":"601e13f9ab6f6ad3","repo":"nautechsystems/nautilus_trader","slug":"invalid-chain-chain-name-in-venue-venue-str","errorCode":null,"errorMessage":"Invalid chain '{chain_name}' in venue '{venue_str}'","messagePattern":"Invalid chain '(.+?)' in venue '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/identifiers/venue.rs","lineNumber":156,"sourceCode":"    }\n\n    #[cfg(feature = \"defi\")]\n    /// Parses a venue string to extract blockchain and DEX type information.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if:\n    /// - The venue string is not in the format \"chain:dex\"\n    /// - The chain name is not recognized\n    /// - The DEX name is not recognized\n    pub fn parse_dex(&self) -> anyhow::Result<(Blockchain, DexType)> {\n        let venue_str = self.as_str();\n        let Some((chain_name, dex_id)) = venue_str.split_once(':') else {\n            anyhow::bail!(\"Venue '{venue_str}' is not a DEX venue (expected format 'Chain:DexId')\")\n        };\n\n        let chain = Chain::from_chain_name(chain_name).ok_or_else(|| {\n            anyhow::anyhow!(\"Invalid chain '{chain_name}' in venue '{venue_str}'\")\n        })?;\n        let dex_type = DexType::from_dex_name(dex_id)\n            .ok_or_else(|| anyhow::anyhow!(\"Invalid DEX '{dex_id}' in venue '{venue_str}'\"))?;\n\n        Ok((chain.name, dex_type))\n    }\n}\n\nimpl Debug for Venue {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"\\\"{}\\\"\", self.0)\n    }\n}\n\nimpl Display for Venue {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        write!(f, \"{}\", self.0)\n    }","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/identifiers/venue.rs#L138-L174","documentation":"Venue::parse_dex expects a DEX venue string in 'Chain:DexId' format and validates the chain part against known chains via Chain::from_chain_name. If the text before the colon is not a recognized chain name, this error is raised.","triggerScenarios":"Calling parse_dex on a venue whose prefix is not a registered chain name, e.g. \"ETHEREUM:uniswap\" when the chain registry uses \"Ethereum\", or a completely unknown chain like \"SOLANAMAINNET:raydium\".","commonSituations":"Configuring a DeFi venue by hand with wrong casing for the chain, using a chain the installation does not know, or forgetting that parse_dex only accepts venues that actually contain a ':' separator (well-formed DEX strings but bogus chain names).","solutions":["Use the exact canonical chain name recognized by Chain::from_chain_name (check casing, e.g. 'Ethereum', 'Solana', 'Arbitrum').","Verify the chain is registered/compiled into the build; register or add the chain if it is a supported-but-missing one.","Log/inspect the full venue string to confirm the prefix before the ':' is the chain and the suffix is the DEX."],"exampleFix":"// before\nlet (chain, dex) = Venue::from(\"ETHEREUM:uniswap\").parse_dex()?;\n// after\nlet (chain, dex) = Venue::from(\"Ethereum:uniswap\").parse_dex()?;","handlingStrategy":"validation","validationCode":"let (chain_name, _) = venue_str.split_once(':')?;\nif Chain::from_chain_name(chain_name).is_none() {\n    return Err(format!(\"unknown chain {chain_name}\"));\n}","typeGuard":null,"tryCatchPattern":"// Rust\nlet (chain, dex) = venue.parse_dex().map_err(|e| ConfigError::BadDexVenue(e.to_string()))?;","preventionTips":["Validate 'Chain:DexId' venue strings at config load time, not at trade time","Use canonical chain names matching Chain::from_chain_name","Enumerate supported chains in startup checks"],"tags":["identifier","venue","dex","chain","invalid-argument-format"],"backgroundTag":"invalid-identifier-format","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}