nautechsystems/nautilus_trader · error

Execution mass status account ID {} did not match source acc

Error message

Execution mass status account ID {} did not match source account {}

What it means

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.

Source

Thrown at crates/execution/src/client/mod.rs:177

    /// Generates mass status for executions.
    ///
    /// # Errors
    ///
    /// Returns an error if status generation fails.
    pub async fn generate_mass_status(
        &self,
        lookback_mins: Option<u64>,
    ) -> anyhow::Result<Option<ExecutionMassStatus>> {
        let mass_status = self.client.generate_mass_status(lookback_mins).await?;

        if let Some(mass_status) = &mass_status {
            anyhow::ensure!(
                mass_status.client_id == self.client_id,
                "Execution mass status client ID {} did not match source client {}",
                mass_status.client_id,
                self.client_id,
            );
            anyhow::ensure!(
                mass_status.account_id == self.account_id,
                "Execution mass status account ID {} did not match source account {}",
                mass_status.account_id,
                self.account_id,
            );
            anyhow::ensure!(
                mass_status.venue == self.venue,
                "Execution mass status venue {} did not match source venue {}",
                mass_status.venue,
                self.venue,
            );
        }

        Ok(mass_status)
    }

    /// Forwards an instrument update to the underlying execution client.
    pub fn on_instrument(&mut self, instrument: InstrumentAny) {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Update the adapter's account_id configuration to match the account the broker actually reports.
  2. Verify the broker session is authenticated to the intended account before requesting mass status.
  3. Check the venue adapter's account-id mapping/stamping in its generate_mass_status implementation.
  4. Compare both account ids in logs to confirm which is stale, then fix the config side.
Defensive patterns

Strategy: validation

Validate before calling

// verify the authenticated account before requesting mass status
if broker_session.account_id != client.account_id() {
    return Err(anyhow::anyhow!("connected to wrong account {}", broker_session.account_id));
}

Try / catch

if let Err(e) = client.generate_mass_status(lookback).await {
    if e.to_string().contains("did not match source account") {
        // fix account_id config and reconnect
    }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/dfa716294c737027. Report an issue: GitHub.