{"record":{"id":"d8dc76954e38a480","repo":"nautechsystems/nautilus_trader","slug":"unknown-venue-code-code","errorCode":null,"errorMessage":"Unknown venue code: {code}","messagePattern":"Unknown venue code: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/identifiers/venue.rs","lineNumber":120,"sourceCode":"    #[must_use]\n    pub fn from_str_unchecked<T: AsRef<str>>(s: T) -> Self {\n        Self(Ustr::from(s.as_ref()))\n    }\n\n    #[must_use]\n    pub const fn from_ustr_unchecked(s: Ustr) -> Self {\n        Self(s)\n    }\n\n    /// # Errors\n    ///\n    /// Returns an error if the venue code is unknown.\n    pub fn from_code(code: &str) -> anyhow::Result<Self> {\n        let map_guard = VENUE_MAP.lock();\n        map_guard\n            .get(code)\n            .copied()\n            .ok_or_else(|| anyhow::anyhow!(\"Unknown venue code: {code}\"))\n    }\n\n    #[must_use]\n    pub fn synthetic() -> Self {\n        Self::new(SYNTHETIC_VENUE)\n    }\n\n    #[must_use]\n    pub fn is_synthetic(&self) -> bool {\n        self.0 == SYNTHETIC_VENUE\n    }\n\n    /// Returns true if the venue represents a decentralized exchange (contains ':').\n    #[cfg(feature = \"defi\")]\n    #[must_use]\n    pub fn is_dex(&self) -> bool {\n        self.0.contains(':')\n    }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/identifiers/venue.rs#L102-L138","documentation":"Venue::from_code looks up a venue code string in a global registry (VENUE_MAP) of known exchange venues. If the code was never registered (venues register themselves at init, typically via PyO3/Currency registration), the lookup fails and this error is returned.","triggerScenarios":"Calling Venue::from_code(\"BINANCE\") (or any string) before the corresponding venue has been registered into VENUE_MAP, or with a misspelled/unknown code such as wrong case or an unsupported exchange.","commonSituations":"Typo in venue config (e.g. \"BINANCE-FUTURE\" vs \"BINANCE_FUTURES\"), using an adapter venue without importing/initializing its adapter crate, case mismatch (lowercase input), or running a stripped build where the adapter never registered.","solutions":["Correct the venue code spelling and case to a registered venue identifier.","Ensure the relevant adapter/venue registration code runs before from_code (import and initialize the adapter crate or call the registration entry point).","If the venue is intentionally custom, use Venue::new (internal) or the synthetic venue instead of from_code."],"exampleFix":"// before\nlet venue = Venue::from_code(\"binance\")?;\n// after\nlet venue = Venue::from_code(\"BINANCE\")?;","handlingStrategy":"validation","validationCode":"match Venue::from_code(code) {\n    Ok(v) => v,\n    Err(e) => { log::error!(\"venue code not registered: {e}\"); return; }\n}","typeGuard":null,"tryCatchPattern":"// Rust\nlet venue = Venue::from_code(code).map_err(|e| ConfigError::BadVenue(e.to_string()))?;","preventionTips":["Keep venue codes in a central constant list validated at config load","Initialize/import all needed adapters before resolving venues from strings","Use exact uppercase canonical codes; validate config at startup"],"tags":["identifier","venue","lookup-failed","rust"],"backgroundTag":"invalid-identifier","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"}