{"record":{"id":"777df2cfb4e1d9da","repo":"nautechsystems/nautilus_trader","slug":"persisted-swap-account-does-not-match-execution-cl","errorCode":null,"errorMessage":"Persisted swap account does not match execution client account","messagePattern":"Persisted swap account does not match execution client account","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1057,"sourceCode":"            intent\n                .instrument_id\n                .as_deref()\n                .ok_or_else(|| anyhow::anyhow!(\"Persisted swap intent has no instrument ID\"))?,\n        )?;\n        anyhow::ensure!(\n            order.instrument_id() == instrument_id,\n            \"Persisted swap instrument {instrument_id} does not match restored order instrument {}\",\n            order.instrument_id()\n        );\n        anyhow::ensure!(\n            intent.trader_id.as_deref() == Some(order.trader_id().as_str()),\n            \"Persisted swap trader does not match restored order\"\n        );\n        anyhow::ensure!(\n            intent.strategy_id.as_deref() == Some(order.strategy_id().as_str()),\n            \"Persisted swap strategy does not match restored order\"\n        );\n        anyhow::ensure!(\n            intent.account_id.as_deref() == Some(self.core.account_id.as_str()),\n            \"Persisted swap account does not match execution client account\"\n        );\n\n        let pool = self.resolve_pool(&instrument_id)?;\n        let pool_address = Address::from_str(\n            intent\n                .pool_address\n                .as_deref()\n                .ok_or_else(|| anyhow::anyhow!(\"Persisted swap intent has no pool address\"))?,\n        )?;\n        anyhow::ensure!(\n            pool.address == pool_address,\n            \"Persisted pool {pool_address} does not match restored pool {}\",\n            pool.address\n        );\n        let amount_in = U256::from_str(\n            intent","sourceCodeStart":1039,"sourceCodeEnd":1075,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1039-L1075","documentation":"restore_swap_plan verifies that the account_id persisted on the execution intent matches the account_id of this execution client (self.core.account_id). A mismatch means the durable swap intent was written by a different execution client account (e.g. another wallet or venue account), so reconciliation refuses to restore and re-drive the swap. This stops swaps belonging to one account from being executed by another.","triggerScenarios":"reconcile_unresolved_execution or build_execution_verification_migration restores an ExecutionIntentRow whose intent.account_id is None or differs from self.core.account_id during restore_swap_plan. Happens when the execution client's account (wallet/venue account id) changed between runs, or the durable store contains intents from another account.","commonSituations":"Rotating wallet or changing account_id config while intents were pending; pointing one node at another account's database; running multiple execution clients (different accounts) against a shared durable store; old rows with NULL account_id.","solutions":["Configure the execution client with the same account_id that persisted the intents (revert wallet/account changes or use the original database).","Separate durable stores per account so intents are never shared across accounts.","Resolve or clear the pending intent in the durable store before switching accounts.","Verify cache/database wiring so the node connects to the store belonging to the configured account."],"exampleFix":"// before\naccount_id = \"BLOCKCHAIN-0xNewWallet\"\n// after (account that wrote the intents)\naccount_id = \"BLOCKCHAIN-0xOriginalWallet\"","handlingStrategy":"validation","validationCode":"if intent.account_id.as_deref() != Some(exec_client_account_id.as_str()) {\n    eprintln!(\"persisted intent belongs to a different account; align account_id config or use the original database\");\n}","typeGuard":"fn account_matches(intent: &ExecutionIntentRow, client_account_id: &AccountId) -> bool {\n    intent.account_id.as_deref() == Some(client_account_id.as_str())\n}","tryCatchPattern":null,"preventionTips":["Keep wallet/account_id stable; rotate only after all intents are resolved","Use one durable store per account","Verify DB wiring matches the configured account before connect","Inspect account_id on persisted rows when migrating environments"],"tags":["persistence","reconciliation","account-id","identity-mismatch"],"backgroundTag":"type-mismatch","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}