nautechsystems/nautilus_trader · error · anyhow::Error

Invalid pool swap address: {}

Error message

Invalid pool swap address: {}

What it means

Thrown in `handle_subscribe_command` when the pool address for a burn-event subscription fails `validate_address`. Same validation rules (0x prefix, 42 chars, hex, EIP-55 checksum); the error message drops the underlying cause and reports only the instrument_id.

Source

Thrown at crates/adapters/blockchain/src/data/client.rs:657

                } else {
                    anyhow::bail!(
                        "Invalid venue {}, expected Blockchain DEX format",
                        cmd.instrument_id.venue
                    )
                }

                Ok(())
            }
            DefiSubscribeCommand::PoolLiquidityUpdates(cmd) => {
                log::debug!(
                    "Processing subscribe pool liquidity updates command for address: {}",
                    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(|_| {
                            anyhow::anyhow!("Invalid pool swap address: {}", cmd.instrument_id)
                        })?;
                    core_client
                        .subscription_manager
                        .subscribe_burns(dex, pool_address);
                    core_client
                        .subscription_manager
                        .subscribe_mints(dex, pool_address);
                    Self::update_rpc_pool_event_subscriptions(core_client, dex).await?;
                    Self::update_hypersync_pool_event_stream(core_client, dex).await?;
                } else {
                    anyhow::bail!(
                        "Invalid venue {}, expected Blockchain DEX format",
                        cmd.instrument_id.venue
                    )
                }

                Ok(())
            }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Use the checksummed pool contract address as the instrument symbol.
  2. Fix the address case to EIP-55 checksum form before issuing the subscribe command.
  3. Validate the address client-side (0x prefix, 42 chars, hex, checksum) before subscribing.
  4. Confirm the pool exists on the configured DEX/venue.

Example fix

// before
"0xcbcdf9646c6055eccbd9cb49903b9ac8bad9255f"
// after
"0xCBcdf9646c6055eCcBD9CB49903b9aC8bAd9255f"
Defensive patterns

Strategy: validation

Validate before calling

// Rust
assert!(symbol.starts_with("0x") && symbol.len() == 42);
Address::parse_checksummed(symbol, None)?;

Try / catch

match Address::parse_checksummed(symbol, None) {
    Ok(addr) => subscribe_burns(dex, addr),
    Err(_) => log::error!("Cannot subscribe burns: '{instrument_id}' symbol is not a checksummed address"),
}

Prevention

When it happens

Trigger: Subscribing to pool burn events with a command whose `instrument_id.symbol` is not a valid checksummed Ethereum pool address.

Common situations: Addresses copied in all-lowercase from Etherscan's URL; token ticker used instead of pool address; malformed addresses from hand-written configs or CSVs.

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


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/0587eacec5629170. Report an issue: GitHub.