nautechsystems/nautilus_trader · error

AX whoami returned no accounts to resolve fees from

Error message

AX whoami returned no accounts to resolve fees from

What it means

request_account_fees resolves maker/taker fee rates from the first account returned by the AX whoami endpoint. If whoami succeeds but returns an empty accounts list, there is no account to resolve fees from, so this error is raised.

Solutions

  1. Verify the API credentials belong to a user with at least one AX account
  2. Check the AX console/dashboard that the account is active and linked to the key
  3. Confirm you are pointing at the intended environment (production vs test) with the right keys
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check by calling whoami before relying on fee resolution
let whoami = client.get_whoami().await?;
if whoami.accounts.is_empty() {
    return Err(anyhow::anyhow!("AX account has no accounts; cannot resolve fees"));
}

Try / catch

match client.request_account_fees().await {
    Err(e) if e.to_string().contains("no accounts") => {
        log::error!("AX credentials have no accounts; check provisioning/env");
        // stop or run without cached fees
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling request_account_fees when the authenticated AX user has zero accounts — whoami returns successfully with accounts: [].

Common situations: API keys created before an account was provisioned; credentials scoped to a user with no trading accounts; misconfigured environment pointing at a sandbox/test user with no accounts.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at crates/adapters/architect_ax/src/http/client.rs:1383

    /// including the periodic refresh, keep reporting them.
    ///
    /// Requires an authenticated client.
    ///
    /// # Errors
    ///
    /// Returns an error if the request fails, the response carries no accounts, or the selected
    /// account supplies no fee rates. An absent rate is not treated as zero, because a zero rate
    /// is itself valid and a silent zero would outlive the response that caused it.
    pub async fn request_account_fees(&self) -> anyhow::Result<(Decimal, Decimal)> {
        let whoami = self
            .inner
            .get_whoami()
            .await
            .map_err(|e| anyhow::anyhow!(e))
            .context("failed to request AX whoami")?;

        let Some(account) = whoami.accounts.first() else {
            anyhow::bail!("AX whoami returned no accounts to resolve fees from");
        };

        if whoami.accounts.len() > 1 {
            log::warn!(
                "AX credentials cover {} accounts, using fee rates from {}",
                whoami.accounts.len(),
                account.id,
            );
        }

        let (Some(maker_fee), Some(taker_fee)) = (account.maker_fee, account.taker_fee) else {
            anyhow::bail!("AX whoami account {} supplied no fee rates", account.id);
        };

        let fees = (maker_fee, taker_fee);
        self.account_fees.store(Some(Arc::new(fees)));

        Ok(fees)

View on GitHub (pinned to 18893faf8b)