nautechsystems/nautilus_trader · error

Failed to get futures accounts: {error_msg}

Error message

Failed to get futures accounts: {error_msg}

What it means

request_account_state calls the Kraken Futures get_accounts endpoint and bails when the API responds with a non-Success result, forwarding the API's error string. It is a wrapper that surfaces upstream exchange errors to the adapter caller.

Source

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

    /// Nautilus `AccountState` event containing balances and margin info.
    ///
    /// # Errors
    ///
    /// Returns an error if:
    /// - Credentials are missing.
    /// - The request fails.
    /// - Response parsing fails.
    pub async fn request_account_state(
        &self,
        account_id: AccountId,
    ) -> anyhow::Result<AccountState> {
        let accounts_response = self.inner.get_accounts().await?;

        if accounts_response.result != KrakenApiResult::Success {
            let error_msg = accounts_response
                .error
                .unwrap_or_else(|| "Unknown error".to_string());
            anyhow::bail!("Failed to get futures accounts: {error_msg}");
        }

        let ts_init = self.generate_ts_init();

        let mut balances: Vec<AccountBalance> = Vec::new();
        let mut margins: Vec<MarginBalance> = Vec::new();

        for account in accounts_response.accounts.values() {
            match account.account_type {
                KrakenFuturesAccountType::MultiCollateralMarginAccount => {
                    parse_multi_collateral_balances(account, &mut balances);
                    parse_multi_collateral_margins(account, &mut margins);
                }
                KrakenFuturesAccountType::MarginAccount => {
                    parse_margin_account_balances(account, &mut balances);
                    parse_margin_account_margins(account, &mut margins);
                }
                KrakenFuturesAccountType::CashAccount => {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Read the embedded {error_msg} for the exchange's own reason and fix credentials/permissions accordingly.
  2. Verify the API key has futures read access and matches the intended account (flex vs standalone).
  3. Retry after backoff if the message indicates rate limiting or temporary unavailability.
Defensive patterns

Strategy: try-catch

Try / catch

// Rust
match adapter.request_account_state().await {
    Ok(state) => handle(state),
    Err(e) => {
        log::error!("kraken futures accounts failed: {e}");
        // inspect wrapped API error_msg, backoff/retry on transient errors
    }
}

Prevention

When it happens

Trigger: Calling request_account_state (account state request) when Kraken Futures returns result != Success — e.g. invalid API credentials, expired nonce, or exchange-side outage.

Common situations: Misconfigured futures API keys (spot keys used for futures), wrong account section (flex/multi-collateral not enabled), rate limiting, or Kraken maintenance windows.

Related errors


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