nautechsystems/nautilus_trader · error · anyhow::Error
Wallet balance snapshot is missing configured token addresse
Error message
Wallet balance snapshot is missing configured token addresses: {} What it means
validate_token_addresses fails when the snapshot contains no balance entries for one or more configured token addresses (and no unexpected addresses). The configured tokens are treated as required, so an incomplete snapshot is an error.
Source
Thrown at crates/model/src/defi/wallet.rs:250
let mut missing = self
.token_universe
.difference(&token_addresses)
.copied()
.collect::<Vec<_>>();
let mut unexpected = token_addresses
.difference(&self.token_universe)
.copied()
.collect::<Vec<_>>();
missing.sort_unstable();
unexpected.sort_unstable();
match (missing.is_empty(), unexpected.is_empty()) {
(false, false) => anyhow::bail!(
"Wallet balance snapshot is missing configured token addresses: {}; contains unexpected token addresses: {}",
format_addresses(&missing),
format_addresses(&unexpected)
),
(false, true) => anyhow::bail!(
"Wallet balance snapshot is missing configured token addresses: {}",
format_addresses(&missing)
),
(true, false) => anyhow::bail!(
"Wallet balance snapshot contains unexpected token addresses: {}",
format_addresses(&unexpected)
),
(true, true) => Ok(()),
}
}
}
fn format_addresses(addresses: &[Address]) -> String {
addresses
.iter()
.map(ToString::to_string)
.collect::<Vec<_>>()
.join(", ")View on GitHub (pinned to 18893faf8b)
Solutions
- Remove tokens your wallet does not hold from the configured token address list.
- Re-query balances; include zero-balance entries for configured tokens when building the snapshot.
- Check the RPC/provider response for the listed missing addresses to see if the query failed for those tokens.
Example fix
// before let snapshot = WalletBalanceSnapshot::new(balances.iter().filter(|b| !b.is_zero()).cloned().collect()); // after let snapshot = WalletBalanceSnapshot::new(balances.clone()); // keep zero-balance entries for configured tokens
Defensive patterns
Strategy: validation
Validate before calling
let missing: Vec<_> = configured.iter().filter(|t| !snapshot.contains_token(t)).collect();
debug_assert!(missing.is_empty(), "snapshot missing configured tokens: {:?}", missing); Prevention
- Include zero-balance entries for every configured token when building snapshots.
- Confirm each configured token is actually held by the wallet on that chain.
When it happens
Trigger: Calling account_balances when the snapshot's token set is a strict subset of the configured addresses — e.g. the RPC query returned no balance row for a configured token.
Common situations: A token with zero balance is omitted by the data provider, a token was never held by the wallet but is listed in config, or the RPC subscription for that token silently failed.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Invalid tick range: {tick_lower} >= {tick_upper}
- Ticks {tick_lower} and {tick_upper} must be multiples of the
- Invalid tick bounds for {tick_lower} and {tick_upper}
- Slippage {actual_slippage} bps exceeds tolerance {max_slippa
- Insufficient liquidity: requested {amount_out_requested}, av
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/663f2bb2644e9e97.
Report an issue: GitHub.