nautechsystems/nautilus_trader · critical · anyhow::Error

AX whoami returned no accounts to resolve fees from

Error message

AX whoami returned no accounts to resolve fees from

What it means

The whoami call in request_account_fees succeeded but the response contained zero accounts. The doc comment is explicit: fee rates are resolved from the first account, and an absent account cannot supply them - the adapter bails rather than inventing a zero fee rate, because a wrong zero would silently misprice every fill estimate from then on. Effectively your API key is not associated with any trading account.

Source

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

    /// 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 a4b06ed870)

Solutions

  1. Log in to the Architect dashboard and confirm the API key is attached to an active trading account
  2. Verify the environment matches: testnet credentials must point at the testnet base URL, prod keys at prod
  3. If the account was just created, wait and retry connect - provisioning can lag
  4. Contact Architect support if the dashboard shows an account but whoami still returns none
Defensive patterns

Strategy: validation

Validate before calling

// Pre-start check: the key must cover at least one account
let whoami = raw_client.get_whoami().await?;
if whoami.accounts.is_empty() {
    anyhow::bail!(
        "AX key has no accounts; check key-account linking and environment"
    );
}

Prevention

When it happens

Trigger: API key created without account membership (e.g. an org-level or read-only key); key issued for a different environment (testnet key against prod endpoint or vice versa); account recently closed or suspended; Architect provisioning lag after account creation.

Common situations: Freshly issued keys whose account linking had not completed; environment mismatch between the key and the configured base URL; using a key generated for market-data-only access.

Related errors


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