{"record":{"id":"663f2bb2644e9e97","repo":"nautechsystems/nautilus_trader","slug":"wallet-balance-snapshot-is-missing-configured-toke-663f2b","errorCode":null,"errorMessage":"Wallet balance snapshot is missing configured token addresses: {}","messagePattern":"Wallet balance snapshot is missing configured token addresses: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/model/src/defi/wallet.rs","lineNumber":250,"sourceCode":"        let mut missing = self\n            .token_universe\n            .difference(&token_addresses)\n            .copied()\n            .collect::<Vec<_>>();\n        let mut unexpected = token_addresses\n            .difference(&self.token_universe)\n            .copied()\n            .collect::<Vec<_>>();\n        missing.sort_unstable();\n        unexpected.sort_unstable();\n\n        match (missing.is_empty(), unexpected.is_empty()) {\n            (false, false) => anyhow::bail!(\n                \"Wallet balance snapshot is missing configured token addresses: {}; contains unexpected token addresses: {}\",\n                format_addresses(&missing),\n                format_addresses(&unexpected)\n            ),\n            (false, true) => anyhow::bail!(\n                \"Wallet balance snapshot is missing configured token addresses: {}\",\n                format_addresses(&missing)\n            ),\n            (true, false) => anyhow::bail!(\n                \"Wallet balance snapshot contains unexpected token addresses: {}\",\n                format_addresses(&unexpected)\n            ),\n            (true, true) => Ok(()),\n        }\n    }\n}\n\nfn format_addresses(addresses: &[Address]) -> String {\n    addresses\n        .iter()\n        .map(ToString::to_string)\n        .collect::<Vec<_>>()\n        .join(\", \")","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/defi/wallet.rs#L232-L268","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlet snapshot = WalletBalanceSnapshot::new(balances.iter().filter(|b| !b.is_zero()).cloned().collect());\n// after\nlet snapshot = WalletBalanceSnapshot::new(balances.clone()); // keep zero-balance entries for configured tokens","handlingStrategy":"validation","validationCode":"let missing: Vec<_> = configured.iter().filter(|t| !snapshot.contains_token(t)).collect();\ndebug_assert!(missing.is_empty(), \"snapshot missing configured tokens: {:?}\", missing);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include zero-balance entries for every configured token when building snapshots.","Confirm each configured token is actually held by the wallet on that chain."],"tags":["defi","validation","missing-data"],"backgroundTag":"schema-validation-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}