{"record":{"id":"dfa716294c737027","repo":"nautechsystems/nautilus_trader","slug":"execution-mass-status-account-id-did-not-match","errorCode":null,"errorMessage":"Execution mass status account ID {} did not match source account {}","messagePattern":"Execution mass status account ID (.+?) did not match source account (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/execution/src/client/mod.rs","lineNumber":177,"sourceCode":"    /// Generates mass status for executions.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if status generation fails.\n    pub async fn generate_mass_status(\n        &self,\n        lookback_mins: Option<u64>,\n    ) -> anyhow::Result<Option<ExecutionMassStatus>> {\n        let mass_status = self.client.generate_mass_status(lookback_mins).await?;\n\n        if let Some(mass_status) = &mass_status {\n            anyhow::ensure!(\n                mass_status.client_id == self.client_id,\n                \"Execution mass status client ID {} did not match source client {}\",\n                mass_status.client_id,\n                self.client_id,\n            );\n            anyhow::ensure!(\n                mass_status.account_id == self.account_id,\n                \"Execution mass status account ID {} did not match source account {}\",\n                mass_status.account_id,\n                self.account_id,\n            );\n            anyhow::ensure!(\n                mass_status.venue == self.venue,\n                \"Execution mass status venue {} did not match source venue {}\",\n                mass_status.venue,\n                self.venue,\n            );\n        }\n\n        Ok(mass_status)\n    }\n\n    /// Forwards an instrument update to the underlying execution client.\n    pub fn on_instrument(&mut self, instrument: InstrumentAny) {","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/execution/src/client/mod.rs#L159-L195","documentation":"The execution client adapter validates that a generated ExecutionMassStatus carries the same account_id as the adapter was constructed with. A mismatch indicates the report came from a different trading account than the one this client source represents, and reconciliation would compare the wrong account's state.","triggerScenarios":"Calling generate_mass_status(lookback_mins) when the returned mass_status.account_id differs from self.account_id (after the client_id check already passed).","commonSituations":"Broker credentials/config pointing at a different account than the adapter's AccountId; adapter constructed with a hardcoded or outdated account id; venue account rotation or multiple sub-accounts on one connection.","solutions":["Update the adapter's account_id configuration to match the account the broker actually reports.","Verify the broker session is authenticated to the intended account before requesting mass status.","Check the venue adapter's account-id mapping/stamping in its generate_mass_status implementation.","Compare both account ids in logs to confirm which is stale, then fix the config side."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify the authenticated account before requesting mass status\nif broker_session.account_id != client.account_id() {\n    return Err(anyhow::anyhow!(\"connected to wrong account {}\", broker_session.account_id));\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = client.generate_mass_status(lookback).await {\n    if e.to_string().contains(\"did not match source account\") {\n        // fix account_id config and reconnect\n    }\n}","preventionTips":["Keep account_id in one config location shared by adapter and credentials.","Re-verify account id after any credential or environment (live/testnet) change.","Smoke-test generate_mass_status in a staging environment after config changes."],"tags":["execution","reconciliation","account-id","rust"],"backgroundTag":"internal-invariant-violation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}