nautechsystems/nautilus_trader · error
Invalid venue {}, expected Blockchain DEX format
Error message
Invalid venue {}, expected Blockchain DEX format What it means
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.
Source
Thrown at crates/adapters/blockchain/src/data/client.rs:611
core_client
.subscription_manager
.subscribe_flashes(dex, pool_address);
core_client
.subscription_manager
.subscribe_fee_protocol_updates(dex, pool_address);
core_client
.subscription_manager
.subscribe_fee_protocol_collects(dex, pool_address);
Self::update_rpc_pool_event_subscriptions(core_client, dex).await?;
Self::update_hypersync_pool_event_stream(core_client, dex).await?;
log::debug!(
"Subscribed to all pool events for {} at address {}",
cmd.instrument_id,
pool_address
);
} else {
anyhow::bail!(
"Invalid venue {}, expected Blockchain DEX format",
cmd.instrument_id.venue
)
}
Ok(())
}
DefiSubscribeCommand::PoolSwaps(cmd) => {
log::debug!(
"Processing subscribe pool swaps command for {}",
cmd.instrument_id
);
if let Ok((_, dex)) = cmd.instrument_id.venue.parse_dex() {
let pool_address = validate_address(cmd.instrument_id.symbol.as_str())
.map_err(|e| {
anyhow::anyhow!(
"Invalid pool swap address '{}' failed with error: {:?}",View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before
let instrument_id = InstrumentId::from("BTC-USDT.BINANCE");
client.subscribe_pool_events(instrument_id).await?;
// after
let instrument_id = InstrumentId::from("ETH-USDC.UNISWAPV3"); // venue in Blockchain DEX format
client.subscribe_pool_events(instrument_id).await?; Defensive patterns
Strategy: validation
Validate before calling
// Rust caller: check venue before subscribing
let venue = instrument_id.venue.to_string();
if !is_blockchain_dex_venue(&venue) {
return Err(anyhow::anyhow!("Venue '{venue}' is not a Blockchain DEX venue; cannot subscribe to pool events"));
}
client.subscribe_pool_events(instrument_id).await?; Type guard
fn is_blockchain_dex_venue(venue: &str) -> bool {
// must match the adapter's DEX venue naming scheme (e.g. known DEX identifier)
matches!(venue, "UNISWAPV2" | "UNISWAPV3" | "SUSHISWAPV2" | "PANCAKESWAPV3" | "AAVEV3")
} Try / catch
match client.subscribe_pool_events(instrument_id).await {
Ok(_) => {}
Err(e) if e.to_string().contains("Invalid venue") => {
log::error!("venue '{}' not a DEX venue; check instrument config", instrument_id.venue);
}
Err(e) => return Err(e),
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Finalized Swap side {} does not match {} order
- Lighter client_order_index {client_order_index} is outside t
- Failed to load active execution intent: {e}
- Failed to start replacement transaction persistence: {e}
- Failed to lock active execution intent {intent_id}: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/ab87772c11e4d898.
Report an issue: GitHub.