{"record":{"id":"f7cb1d74528e0531","repo":"nautechsystems/nautilus_trader","slug":"failed-to-request-ax-whoami","errorCode":null,"errorMessage":"failed to request AX whoami","messagePattern":"failed to request AX whoami","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/architect_ax/src/http/client.rs","lineNumber":1393,"sourceCode":"    ///\n    /// AX reports fee rates per account rather than per user, and returns the accounts the\n    /// credentials can act on. The first entry is used, which is the account AX resolves when a\n    /// request carries no explicit selector. The rates are retained so later instrument requests,\n    /// including the periodic refresh, keep reporting them.\n    ///\n    /// Requires an authenticated client.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the request fails, the response carries no accounts, or the selected\n    /// account supplies no fee rates. An absent rate is not treated as zero, because a zero rate\n    /// is itself valid and a silent zero would outlive the response that caused it.\n    pub async fn request_account_fees(&self) -> anyhow::Result<(Decimal, Decimal)> {\n        let whoami = self\n            .inner\n            .get_whoami()\n            .await\n            .map_err(|e| anyhow::anyhow!(e))\n            .context(\"failed to request AX whoami\")?;\n\n        let Some(account) = whoami.accounts.first() else {\n            anyhow::bail!(\"AX whoami returned no accounts to resolve fees from\");\n        };\n\n        if whoami.accounts.len() > 1 {\n            log::warn!(\n                \"AX credentials cover {} accounts, using fee rates from {}\",\n                whoami.accounts.len(),\n                account.id,\n            );\n        }\n\n        let (Some(maker_fee), Some(taker_fee)) = (account.maker_fee, account.taker_fee) else {\n            anyhow::bail!(\"AX whoami account {} supplied no fee rates\", account.id);\n        };\n","sourceCodeStart":1375,"sourceCodeEnd":1411,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/architect_ax/src/http/client.rs#L1375-L1411","documentation":"During fee resolution (request_account_fees, called when the execution client builds account state at connect), the whoami REST call failed and its AxHttpError is wrapped with the context 'failed to request AX whoami'. Whoami is the identity endpoint that enumerates the accounts and fee tiers your credentials cover; failure here means the request never yielded a usable response - auth token missing/expired, network error, rate limit, or a venue 5xx - so maker/taker fee rates cannot be resolved and connect aborts.","triggerScenarios":"Connecting the AX execution client when the bearer token is invalid (auth raced or failed), the REST endpoint is unreachable, a 429 was returned, or the venue errored (5xx) precisely when fees were being resolved.","commonSituations":"Intermittent egress problems that only surface on the extra whoami call; rate-limited startups where many clients connect at once; token TTL expiring during a long connect sequence.","solutions":["Read the inner error string to classify: 401/403 -> credential/token problem; network -> connectivity; 429 -> back off and retry connect","Retry engine start once after a short delay; whoami is a cheap idempotent GET","If persistent, verify the key with a direct whoami curl from the same host","Check Architect status/maintenance windows for 5xx bursts"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// request_account_fees at connect: classify and retry transient causes\nfor attempt in 0..3 {\n    match client.request_account_fees().await {\n        Ok(fees) => break Ok(fees),\n        Err(e) if e.to_string().contains(\"whoami\") && is_transient(&e) => {\n            tokio::time::sleep(Duration::from_secs(2u64.pow(attempt))).await;\n        }\n        Err(e) => break Err(e),\n    }\n}","preventionTips":["Treat connect-time whoami failures as retryable with backoff, but stop after auth errors","Stagger multi-client startups to avoid REST 429 storms during fee resolution","Cache last-known fee rates so a degraded connect can at least warn and proceed manually if you accept the risk"],"tags":["architect-ax","whoami","fees","connect","rest-api","rust"],"backgroundTag":"venue-request-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}