nautechsystems/nautilus_trader · error

Execution mass status client ID

Error message

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

What it means

After the execution client adapter receives a ExecutionMassStatus from its underlying client, it verifies the report's client_id equals the adapter's own client_id. A mismatch means the client returned a reconciliation report that does not belong to this client connection, so the adapter refuses it via anyhow::ensure!.

Solutions

  1. Check the ClientId configured on the execution client adapter matches the one the broker adapter embeds in its mass status.
  2. Inspect the adapter's generate_mass_status implementation to confirm it stamps the correct client_id.
  3. Recreate the adapter with the correct client_id for the connected venue/account.
  4. Log both ids on mismatch to identify which side is stale.
Defensive patterns

Strategy: validation

Validate before calling

// before reconciliation, confirm ids line up
assert_eq!(client.client_id(), expected_client_id, "adapter client id mismatch");

Try / catch

match client.generate_mass_status(lookback).await {
    Err(e) if e.to_string().contains("did not match source client") => {
        // reconfigure adapter client_id, then retry
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling generate_mass_status(lookback_mins) when the client's returned mass_status.client_id differs from self.client_id.

Common situations: Adapter wired with the wrong ClientId at construction; broker adapter returning a default or stale client id in its mass status; connecting the same client implementation to a different account/venue without updating the adapter config.

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/d89a8d86984aea0f. Report an issue: GitHub.

Appendix: source

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

        &self,
        cmd: &GeneratePositionStatusReports,
    ) -> anyhow::Result<Vec<PositionStatusReport>> {
        self.client.generate_position_status_reports(cmd).await
    }

    /// 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,
            );
        }

View on GitHub (pinned to 18893faf8b)