nautechsystems/nautilus_trader · error · anyhow::Error

Invalid pool flash subscribe address: {}

Error message

Invalid pool flash subscribe address: {}

What it means

Thrown in `handle_subscribe_command` when the pool address for a flash-loan/flash event subscription fails `validate_address`. Validation requires a `0x`-prefixed, 42-character, hex, EIP-55-checksummed address.

Source

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

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

                Ok(())
            }
            DefiSubscribeCommand::PoolFlashEvents(cmd) => {
                log::debug!(
                    "Processing subscribe pool flash 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 flash subscribe address: {}",
                                cmd.instrument_id
                            )
                        })?;
                    core_client
                        .subscription_manager
                        .subscribe_flashes(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 correct checksummed pool address as the instrument symbol.
  2. Fix casing to EIP-55 checksum form (e.g. via ethers `Address::parse_checksummed` or viem `getAddress`).
  3. Validate the address format before issuing the command.
  4. Ensure the address corresponds to a pool on the configured chain/DEX.

Example fix

// before
pool_symbol.to_lowercase()
// after
Address::from_str(pool_symbol)?.to_checksum(None)
Defensive patterns

Strategy: validation

Validate before calling

// Rust
fn checksum_or_none(s: &str) -> Option<String> {
    Address::parse_checksummed(s, None).ok().map(|a| a.to_checksum(None))
}

Try / catch

let Some(checksummed) = checksum_or_none(symbol) else {
    anyhow::bail!("flash subscribe requires a checksummed pool address, got '{symbol}'");
};

Prevention

When it happens

Trigger: A flash subscribe command where `instrument_id.symbol` is not a well-formed checksummed pool address.

Common situations: Hand-typed addresses with casing mistakes; addresses generated with `to_lowercase()` in preprocessing code; wrong-chain addresses used for the configured venue.

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/a86dfef2a43e8c93. Report an issue: GitHub.