nautechsystems/nautilus_trader · error

Invalid pool flash address: {}

Error message

Invalid pool flash address: {}

What it means

Thrown in handle_unsubscribe_command when the symbol portion of a BlockchainDataInstrumentId cannot be validated as an Ethereum address. The adapter treats the instrument symbol as a pool contract address and uses validate_address (checksum/hex format check) before calling unsubscribe_flashes; any malformed symbol aborts the unsubscribe with this anyhow error wrapping the full instrument id.

Source

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

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

                Ok(())
            }
            DefiUnsubscribeCommand::PoolFlashEvents(cmd) => {
                log::debug!(
                    "Processing unsubscribe pool flash 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(|_| {
                            anyhow::anyhow!("Invalid pool flash address: {}", cmd.instrument_id)
                        })?;
                    core_client
                        .subscription_manager
                        .unsubscribe_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. Pass the pool's contract address as the instrument symbol, e.g. '0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640', not a ticker pair.
  2. Verify the address format: 0x + 40 hex chars with correct EIP-55 checksum, using the same validate_address helper or a checksum tool.
  3. Confirm the instrument id was built by the same adapter that created the subscription (venue must still parse_dex successfully).
  4. Check for truncated or whitespace-padded addresses in config files or instrument id strings.

Example fix

// before
let instrument_id = InstrumentId::from("USDC/WETH.UNI-V3@BASE");
data_client.unsubscribe(instrument_id);

// after
let instrument_id = InstrumentId::from(
    "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640.UNI-V3@BASE",
);
Defensive patterns

Strategy: validation

Validate before calling

fn is_valid_pool_symbol(instrument_id: &InstrumentId) -> bool {
    let s = instrument_id.symbol.as_str();
    s.starts_with("0x") && s.len() == 42 && s[2..].chars().all(|c| c.is_ascii_hexdigit())
}

Prevention

When it happens

Trigger: Calling data_client.unsubscribe() (handle_unsubscribe_command path) with an instrument id whose venue parses as a DEX (e.g. 'ETH/UNI-V3@BASE') but whose symbol is not a valid 0x-hex 20-byte address — wrong checksum casing, truncated address, or a human-readable ticker instead of a contract address.

Common situations: Config files using venue-style symbols like 'USDC/WETH' instead of a pool contract address; addresses copied without the 0x prefix or with wrong EIP-55 checksum; lowercased addresses when the validator enforces checksums.

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