nautechsystems/nautilus_trader · error · anyhow::Error
Wallet balance snapshot is missing configured token addresse
Error message
Wallet balance snapshot is missing configured token addresses: {}; contains unexpected token addresses: {} What it means
validate_token_addresses compares the snapshot's token addresses against the configured token set and fails when addresses are both missing from the snapshot AND unexpected addresses are present. The message lists both sorted, deduplicated address lists.
Source
Thrown at crates/model/src/defi/wallet.rs:245
"Wallet balance snapshot contains duplicate token addresses: {}",
format_addresses(&duplicates)
);
}
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 {View on GitHub (pinned to 18893faf8b)
Solutions
- Compare the missing/unexpected address lists in the error with your configured token list and update the configuration to match the wallet's actual holdings.
- Verify the snapshot was taken for the intended wallet address, chain, and block.
- If tokens legitimately changed, rebuild the snapshot from fresh on-chain data rather than reusing a stale one.
Defensive patterns
Strategy: validation
Validate before calling
let snap_addrs: HashSet<_> = snapshot.token_addresses().into_iter().collect(); let configured: HashSet<_> = configured_tokens.iter().collect(); assert!(snap_addrs.symmetric_difference(&configured).next().is_none(), "snapshot/config token set mismatch");
Prevention
- Derive the configured token list from the same source as the snapshot when possible.
- Log address-set diffs on wallet changes before they break validation.
When it happens
Trigger: Calling account_balances on a snapshot whose token set diverges from the configured expectations in both directions — some configured tokens absent, plus tokens present that were not configured.
Common situations: A wallet acquired or sold a token between configuration and snapshot; tracking config lists one token set while the on-chain wallet holds another; reusing a snapshot from a different wallet or network.
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.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
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/637f0c5f065e44b6.
Report an issue: GitHub.