{"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":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":853,"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":835,"sourceCodeEnd":871,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/execution/client.rs#L835-L871","documentation":"restore_swap_plan (crates/adapters/blockchain/src/execution/client.rs:853) checks the persisted intent's account_id equals self.core.account_id - the execution client's own account. A mismatch means the active swap intent was recorded for a different execution account than the client now running; reconciliation refuses because this client is not the account that owns the on-chain wallet state and order flow. This prevents one account's client from adopting and completing another account's in-flight swap.","triggerScenarios":"The execution client's account_id configuration changed while an intent persisted under the old account is still active; two client configurations (e.g. test and prod accounts) share one Postgres store and the wrong one reconciles the other's intent.","commonSituations":"Switching wallet/account configuration without draining active intents; shared durable stores across multiple trading accounts.","solutions":["Run the client whose account_id matches the intent's recorded account so it can legitimately reconcile.","Or verify the intent's transaction on-chain and mark it resolved so other accounts can connect cleanly.","Give each execution account its own durable store or ensure intents are drained before re-keying accounts.","Check for config drift between environments sharing the database."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"-- Pre-flight: active intents recorded for a different execution account\nSELECT id, account_id, status\nFROM execution_intent\nWHERE status IN ('prepared', 'signed', 'submitted');\n-- compare account_id against the account the client will boot with","typeGuard":"fn is_account_mismatch(e: &anyhow::Error) -> bool {\n    e.to_string().contains(\"Persisted swap account does not match execution client account\")\n}","tryCatchPattern":"if let Err(e) = client.connect().await {\n    if is_account_mismatch(&e) {\n        // this client is not the intent's owner: boot the matching account or resolve the intent\n        log::error!(\"active intent belongs to another execution account: {e}\");\n    }\n    return Err(e);\n}","preventionTips":["Run reconciliation from the client whose account_id created the intent.","Separate durable stores per execution account.","Drain active intents before switching wallet/account configuration."],"tags":["reconciliation","account-id","state-mismatch","configuration","rust"],"backgroundTag":"persisted-state-mismatch","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}