{"record":{"id":"86c975f74bae6d04","repo":"nautechsystems/nautilus_trader","slug":"failed-to-get-futures-accounts-error-msg","errorCode":null,"errorMessage":"Failed to get futures accounts: {error_msg}","messagePattern":"Failed to get futures accounts: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/http/futures/client.rs","lineNumber":1630,"sourceCode":"    /// Nautilus `AccountState` event containing balances and margin info.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if:\n    /// - Credentials are missing.\n    /// - The request fails.\n    /// - Response parsing fails.\n    pub async fn request_account_state(\n        &self,\n        account_id: AccountId,\n    ) -> anyhow::Result<AccountState> {\n        let accounts_response = self.inner.get_accounts().await?;\n\n        if accounts_response.result != KrakenApiResult::Success {\n            let error_msg = accounts_response\n                .error\n                .unwrap_or_else(|| \"Unknown error\".to_string());\n            anyhow::bail!(\"Failed to get futures accounts: {error_msg}\");\n        }\n\n        let ts_init = self.generate_ts_init();\n\n        let mut balances: Vec<AccountBalance> = Vec::new();\n        let mut margins: Vec<MarginBalance> = Vec::new();\n\n        for account in accounts_response.accounts.values() {\n            match account.account_type {\n                KrakenFuturesAccountType::MultiCollateralMarginAccount => {\n                    parse_multi_collateral_balances(account, &mut balances);\n                    parse_multi_collateral_margins(account, &mut margins);\n                }\n                KrakenFuturesAccountType::MarginAccount => {\n                    parse_margin_account_balances(account, &mut balances);\n                    parse_margin_account_margins(account, &mut margins);\n                }\n                KrakenFuturesAccountType::CashAccount => {","sourceCodeStart":1612,"sourceCodeEnd":1648,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/http/futures/client.rs#L1612-L1648","documentation":"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.","triggerScenarios":"Calling request_account_state (account state request) when Kraken Futures returns result != Success — e.g. invalid API credentials, expired nonce, or exchange-side outage.","commonSituations":"Misconfigured futures API keys (spot keys used for futures), wrong account section (flex/multi-collateral not enabled), rate limiting, or Kraken maintenance windows.","solutions":["Read the embedded {error_msg} for the exchange's own reason and fix credentials/permissions accordingly.","Verify the API key has futures read access and matches the intended account (flex vs standalone).","Retry after backoff if the message indicates rate limiting or temporary unavailability."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust\nmatch adapter.request_account_state().await {\n    Ok(state) => handle(state),\n    Err(e) => {\n        log::error!(\"kraken futures accounts failed: {e}\");\n        // inspect wrapped API error_msg, backoff/retry on transient errors\n    }\n}","preventionTips":["Verify futures API keys and permissions before starting the adapter.","Synchronize system clock to avoid nonce errors.","Retry with exponential backoff on transient exchange errors."],"tags":["kraken","futures","api","accounts"],"backgroundTag":"api-error-response","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}