warpdotdev/warp · error · anyhow::Error

API key '{key_identifier}' not found

Error message

API key '{key_identifier}' not found

What it means

`resolve_api_key_identifier` matches the supplied identifier first against key UIDs, then against key names. This error means no listed API key has that UID or name — the identifier is unknown to the account whose keys were listed.

Source

Thrown at app/src/ai/agent_sdk/api_key.rs:323

}

fn resolve_api_key_identifier(
    keys: &[ApiKeyInfo],
    key_identifier: &str,
) -> Result<Option<ApiKeyInfo>> {
    if let Some(key) = keys.iter().find(|key| key.uid == key_identifier) {
        return Ok(Some(key.clone()));
    }

    let mut matches = keys
        .iter()
        .filter(|key| key.name == key_identifier)
        .cloned()
        .collect::<Vec<_>>();
    matches.sort_by_key(|key| Reverse(key.created_at));

    if matches.is_empty() {
        return Err(anyhow!("API key '{key_identifier}' not found"));
    } else if matches.len() == 1 {
        return Ok(Some(matches[0].clone()));
    }

    if io::stdin().is_terminal() {
        return match Select::new(
            &format!("Multiple API keys match '{key_identifier}'. Select a key to expire:"),
            matches,
        )
        .prompt()
        {
            Ok(key) => Ok(Some(key)),
            Err(InquireError::OperationCanceled | InquireError::OperationInterrupted) => Ok(None),
            Err(err) => Err(err.into()),
        };
    }
    println!("Multiple API keys match '{key_identifier}':");
    for key in matches {

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Run `warp api-key list` and copy the exact UID (or name) of the target key
  2. Confirm you are logged in as the account that owns the key (check login status; re-login if needed)
  3. Check whether the key was already expired — expired keys may no longer be listed
  4. Paste identifiers instead of retyping UIDs by hand

Example fix

# before
warp api-key expire wk_abd123   # typo'd uid
# after
warp api-key list
warp api-key expire <uid-from-list>
Defensive patterns

Strategy: validation

Validate before calling

async fn key_identifier_exists(client: &AuthClient, ident: &str) -> anyhow::Result<bool> {
    let keys = client.list_api_keys().await?;
    Ok(keys.iter().any(|k| k.uid == ident || k.name == ident))
}
// Resolve identifiers against a fresh list before expiring.

Prevention

When it happens

Trigger: Running `warp api-key expire <identifier>` where <identifier> matches no `uid` and no `name` among the keys returned by `auth_client.list_api_keys()` for the currently logged-in user.

Common situations: Typo in the key name or UID; the key was already expired or deleted; logged in as a different user than the key's owner; team vs personal key scope confusion.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/f63d242fdac7dc88. Report an issue: GitHub.