{"record":{"id":"ab87772c11e4d898","repo":"nautechsystems/nautilus_trader","slug":"invalid-venue-expected-blockchain-dex-format","errorCode":null,"errorMessage":"Invalid venue {}, expected Blockchain DEX format","messagePattern":"Invalid venue (.+?), expected Blockchain DEX format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/data/client.rs","lineNumber":611,"sourceCode":"                    core_client\n                        .subscription_manager\n                        .subscribe_flashes(dex, pool_address);\n                    core_client\n                        .subscription_manager\n                        .subscribe_fee_protocol_updates(dex, pool_address);\n                    core_client\n                        .subscription_manager\n                        .subscribe_fee_protocol_collects(dex, pool_address);\n                    Self::update_rpc_pool_event_subscriptions(core_client, dex).await?;\n                    Self::update_hypersync_pool_event_stream(core_client, dex).await?;\n\n                    log::debug!(\n                        \"Subscribed to all pool events for {} at address {}\",\n                        cmd.instrument_id,\n                        pool_address\n                    );\n                } else {\n                    anyhow::bail!(\n                        \"Invalid venue {}, expected Blockchain DEX format\",\n                        cmd.instrument_id.venue\n                    )\n                }\n\n                Ok(())\n            }\n            DefiSubscribeCommand::PoolSwaps(cmd) => {\n                log::debug!(\n                    \"Processing subscribe pool swaps command for {}\",\n                    cmd.instrument_id\n                );\n\n                if let Ok((_, dex)) = cmd.instrument_id.venue.parse_dex() {\n                    let pool_address = validate_address(cmd.instrument_id.symbol.as_str())\n                        .map_err(|e| {\n                            anyhow::anyhow!(\n                                \"Invalid pool swap address '{}' failed with error: {:?}\",","sourceCodeStart":593,"sourceCodeEnd":629,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/data/client.rs#L593-L629","documentation":"handle_subscribe_command for \"all pool events\" parses the instrument_id's venue expecting a Blockchain DEX format (a DEX name parsed into the adapter's dex type plus a pool address). If the venue string does not match the expected DEX format, the handler bails instead of subscribing. This protects the subscription manager from venues it cannot map to a DEX/pool pair.","triggerScenarios":"Subscribing to pool events with an InstrumentId whose venue is not a recognized blockchain DEX venue — e.g. a venue like \"BINANCE\" or a manually constructed venue string that fails the DEX name/address parsing, when handling a Subscribe command for all pool events.","commonSituations":"Venue configured incorrectly in the node's instrument definitions; instruments imported from a non-blockchain adapter; venue name casing or chain suffix mismatch (e.g. \"uniswap\" vs expected DEX identifier format).","solutions":["Check the venue portion of cmd.instrument_id and make sure it uses the adapter's Blockchain DEX venue format (correct DEX name as recognized by the venue parser).","Verify the instrument was created by the blockchain adapter's synthetic-instrument generation rather than hand-constructed.","Log/inspect cmd.instrument_id.venue at the failing call and compare against venues produced by the adapter's venue parsing helper.","If subscribing to a centralized venue, route the command to the appropriate adapter instead of the blockchain data client."],"exampleFix":"// before\nlet instrument_id = InstrumentId::from(\"BTC-USDT.BINANCE\");\nclient.subscribe_pool_events(instrument_id).await?;\n// after\nlet instrument_id = InstrumentId::from(\"ETH-USDC.UNISWAPV3\"); // venue in Blockchain DEX format\nclient.subscribe_pool_events(instrument_id).await?;","handlingStrategy":"validation","validationCode":"// Rust caller: check venue before subscribing\nlet venue = instrument_id.venue.to_string();\nif !is_blockchain_dex_venue(&venue) {\n    return Err(anyhow::anyhow!(\"Venue '{venue}' is not a Blockchain DEX venue; cannot subscribe to pool events\"));\n}\nclient.subscribe_pool_events(instrument_id).await?;","typeGuard":"fn is_blockchain_dex_venue(venue: &str) -> bool {\n    // must match the adapter's DEX venue naming scheme (e.g. known DEX identifier)\n    matches!(venue, \"UNISWAPV2\" | \"UNISWAPV3\" | \"SUSHISWAPV2\" | \"PANCAKESWAPV3\" | \"AAVEV3\")\n}","tryCatchPattern":"match client.subscribe_pool_events(instrument_id).await {\n    Ok(_) => {}\n    Err(e) if e.to_string().contains(\"Invalid venue\") => {\n        log::error!(\"venue '{}' not a DEX venue; check instrument config\", instrument_id.venue);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Only use instrument IDs generated by the blockchain adapter's instrument provider.","Store venue constants for supported DEXes instead of typing venue strings.","Validate venue format at configuration load time, before the node starts subscribing.","Never mix instrument IDs from other adapters into blockchain pool subscriptions."],"tags":["rust","anyhow","venue","validation","blockchain"],"backgroundTag":"invalid-argument-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"}