{"record":{"id":"528efee42d6e8831","repo":"nautechsystems/nautilus_trader","slug":"invalid-venue","errorCode":null,"errorMessage":"Invalid venue","messagePattern":"Invalid venue","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/common/src/messages/defi/mod.rs","lineNumber":183,"sourceCode":"                    cmd.client_id,\n                    command_id,\n                    ts_init,\n                    cmd.params,\n                ))\n            }\n        }\n    }\n\n    /// Returns the blockchain associated with this command.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the instrument ID's venue cannot be parsed as a valid blockchain venue\n    /// for `Pool`, `PoolSwaps`, `PoolLiquidityUpdates`, `PoolFeeCollects`, or `PoolFlashEvents` commands.\n    pub fn blockchain(&self) -> Blockchain {\n        match self {\n            Self::Blocks(cmd) => cmd.chain,\n            Self::Pool(cmd) => cmd.instrument_id.blockchain().expect(\"Invalid venue\"),\n            Self::PoolSwaps(cmd) => cmd.instrument_id.blockchain().expect(\"Invalid venue\"),\n            Self::PoolLiquidityUpdates(cmd) => {\n                cmd.instrument_id.blockchain().expect(\"Invalid venue\")\n            }\n            Self::PoolFeeCollects(cmd) => cmd.instrument_id.blockchain().expect(\"Invalid venue\"),\n            Self::PoolFlashEvents(cmd) => cmd.instrument_id.blockchain().expect(\"Invalid venue\"),\n        }\n    }\n\n    pub fn command_id(&self) -> UUID4 {\n        match self {\n            Self::Blocks(cmd) => cmd.command_id,\n            Self::Pool(cmd) => cmd.command_id,\n            Self::PoolSwaps(cmd) => cmd.command_id,\n            Self::PoolLiquidityUpdates(cmd) => cmd.command_id,\n            Self::PoolFeeCollects(cmd) => cmd.command_id,\n            Self::PoolFlashEvents(cmd) => cmd.command_id,\n        }","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/common/src/messages/defi/mod.rs#L165-L201","documentation":"`NautilusKernelCommand::blockchain()` extracts the `Blockchain` from a DeFi command's instrument_id venue via `instrument_id.blockchain().expect(\"Invalid venue\")`. It panics when the venue name is not a parseable blockchain venue. The method is only valid for pool-related commands whose venue encodes a chain.","triggerScenarios":"Calling `blockchain()` on a Pool/PoolSwaps/PoolLiquidityUpdates/PoolFeeCollects/PoolFlashEvents command whose `instrument_id.venue` string does not correspond to a known blockchain venue.","commonSituations":"Constructing DeFi subscribe/query commands with a hand-typed or arbitrary venue (e.g. an exchange venue instead of a chain name); venue case/typo mismatch; cross-wiring trading instruments into DeFi commands.","solutions":["Validate `instrument_id.blockchain()` returns Some before constructing/sending the command","Build instrument IDs using the Blockchain venue constructor rather than raw strings","Check venue spelling/case against supported blockchain venues (e.g. Ethereum, Arbitrum, Base)","Use the Blocks command (which carries `chain` directly) when possible instead of venue-derived chains"],"exampleFix":"// before\nlet chain = cmd.instrument_id.blockchain().expect(\"Invalid venue\");\n// after\nlet chain = cmd.instrument_id.blockchain()\n    .ok_or_else(|| anyhow::anyhow!(\"invalid blockchain venue: {}\", cmd.instrument_id.venue))?;","handlingStrategy":"validation","validationCode":"if cmd.instrument_id.blockchain().is_none() {\n    eprintln!(\"venue {} is not a blockchain\", cmd.instrument_id.venue);\n    return;\n}","typeGuard":"fn is_defi_command(cmd: &NautilusKernelCommand) -> bool {\n    matches!(cmd, NautilusKernelCommand::Pool(_)\n        | NautilusKernelCommand::PoolSwaps(_)\n        | NautilusKernelCommand::PoolLiquidityUpdates(_)\n        | NautilusKernelCommand::PoolFeeCollects(_)\n        | NautilusKernelCommand::PoolFlashEvents(_))\n}","tryCatchPattern":null,"preventionTips":["Build DeFi instrument IDs from typed Blockchain venues, never free-form strings","Validate the venue parses as a Blockchain before constructing pool commands","Never reuse centralized-exchange venues for DeFi commands","Check exact chain-name spelling and casing against supported venues"],"tags":["rust","panic","defi","venue","instrument-id"],"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"}