nautechsystems/nautilus_trader · error · anyhow::Error
Invalid pool swap address '{}' failed with error: {:?}
Error message
Invalid pool swap address '{}' failed with error: {:?} What it means
Thrown in `handle_subscribe_command` when the symbol of a pool-swaps subscribe command fails `validate_address` (missing 0x prefix, wrong length, invalid hex, or bad EIP-55 checksum). It aborts the swap subscription for that instrument_id.
Source
Thrown at crates/adapters/blockchain/src/data/client.rs:628
} 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: {:?}",
cmd.instrument_id,
e
)
})?;
core_client
.subscription_manager
.subscribe_swaps(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
- Supply the pool address in checksummed form as the instrument symbol before subscribing to swaps.
- Run the address through checksum validation (`Address::parse_checksummed`) or an equivalent checker first.
- Ensure no surrounding whitespace/characters are concatenated into the symbol.
- Verify the correct DEX pool contract address for the venue being used.
Example fix
// before "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640".to_string() // after "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640".to_string()
Defensive patterns
Strategy: validation
Validate before calling
// Rust
let addr = Address::parse_checksummed(symbol, None)
.context("symbol must be an EIP-55 checksummed pool address")?; Try / catch
if let Err(e) = Address::parse_checksummed(symbol, None) {
return Err(anyhow::anyhow!("swap subscribe aborted: invalid pool address '{symbol}': {e}"));
} Prevention
- Normalize addresses to checksum form when received from any source (explorer URLs are lowercase).
- Add a unit test asserting every instrument symbol in your config passes Address::parse_checksummed.
- Ensure serialization round-trips preserve address casing.
- Verify you are using the pool contract, not a token contract.
When it happens
Trigger: Issuing a PoolSwaps subscribe command whose `instrument_id.symbol` is not a checksummed 42-character 0x pool address.
Common situations: Lowercase addresses copied from block explorers; symbol fields populated with token names; addresses built programmatically without checksum encoding.
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
- Invalid pool address '{}' failed with error: {:?}
- Invalid pool swap address: {}
- Invalid pool fee collect address: {}
- Invalid pool flash subscribe address: {}
- Invalid pool address: {}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/2b22f870637cb1ca.
Report an issue: GitHub.