nautechsystems/nautilus_trader · error

Failed to get open positions: {error_msg}

Error message

Failed to get open positions: {error_msg}

What it means

request_position_status_reports calls get_open_positions and bails when the API result is not Success, forwarding the exchange error message. Position status reports cannot be generated from a failed response.

Source

Thrown at crates/adapters/kraken/src/http/futures/client.rs:1883

        }

        Ok(all_reports)
    }

    pub async fn request_position_status_reports(
        &self,
        account_id: AccountId,
        instrument_id: Option<InstrumentId>,
    ) -> anyhow::Result<Vec<PositionStatusReport>> {
        let ts_init = self.generate_ts_init();
        let mut all_reports = Vec::new();

        let response = self.inner.get_open_positions().await?;
        if response.result != KrakenApiResult::Success {
            let error_msg = response
                .error
                .unwrap_or_else(|| "Unknown error".to_string());
            anyhow::bail!("Failed to get open positions: {error_msg}");
        }

        for position in response.open_positions {
            if let Some(ref target_id) = instrument_id {
                let instrument = self.get_cached_instrument(&target_id.symbol.inner());
                if let Some(inst) = instrument
                    && inst.raw_symbol().as_str() != position.symbol
                {
                    continue;
                }
            }

            if let Some(instrument) = self.get_instrument_by_raw_symbol(&position.symbol) {
                match parse_futures_position_status_report(
                    &position,
                    &instrument,
                    account_id,
                    ts_init,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Check the embedded {error_msg} for the underlying exchange reason.
  2. Confirm the key is a futures-enabled key with positions read access.
  3. Retry after backoff for transient errors.
Defensive patterns

Strategy: try-catch

Try / catch

match adapter.request_position_status_reports(None).await {
    Ok(positions) => update(positions),
    Err(e) => log::error!("positions fetch failed: {e}"),
}

Prevention

When it happens

Trigger: Calling request_position_status_reports when get_open_positions returns result != Success — invalid credentials, missing permissions, or exchange-side failure.

Common situations: Using a spot API key against the futures endpoint; account without positions API access; Kraken maintenance periods.

Related errors


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