{"record":{"id":"f63d242fdac7dc88","repo":"warpdotdev/warp","slug":"api-key-key-identifier-not-found","errorCode":null,"errorMessage":"API key '{key_identifier}' not found","messagePattern":"API key '(.+?)' not found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/api_key.rs","lineNumber":323,"sourceCode":"}\n\nfn resolve_api_key_identifier(\n    keys: &[ApiKeyInfo],\n    key_identifier: &str,\n) -> Result<Option<ApiKeyInfo>> {\n    if let Some(key) = keys.iter().find(|key| key.uid == key_identifier) {\n        return Ok(Some(key.clone()));\n    }\n\n    let mut matches = keys\n        .iter()\n        .filter(|key| key.name == key_identifier)\n        .cloned()\n        .collect::<Vec<_>>();\n    matches.sort_by_key(|key| Reverse(key.created_at));\n\n    if matches.is_empty() {\n        return Err(anyhow!(\"API key '{key_identifier}' not found\"));\n    } else if matches.len() == 1 {\n        return Ok(Some(matches[0].clone()));\n    }\n\n    if io::stdin().is_terminal() {\n        return match Select::new(\n            &format!(\"Multiple API keys match '{key_identifier}'. Select a key to expire:\"),\n            matches,\n        )\n        .prompt()\n        {\n            Ok(key) => Ok(Some(key)),\n            Err(InquireError::OperationCanceled | InquireError::OperationInterrupted) => Ok(None),\n            Err(err) => Err(err.into()),\n        };\n    }\n    println!(\"Multiple API keys match '{key_identifier}':\");\n    for key in matches {","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/api_key.rs#L305-L341","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `warp api-key list` and copy the exact UID (or name) of the target key","Confirm you are logged in as the account that owns the key (check login status; re-login if needed)","Check whether the key was already expired — expired keys may no longer be listed","Paste identifiers instead of retyping UIDs by hand"],"exampleFix":"# before\nwarp api-key expire wk_abd123   # typo'd uid\n# after\nwarp api-key list\nwarp api-key expire <uid-from-list>","handlingStrategy":"validation","validationCode":"async fn key_identifier_exists(client: &AuthClient, ident: &str) -> anyhow::Result<bool> {\n    let keys = client.list_api_keys().await?;\n    Ok(keys.iter().any(|k| k.uid == ident || k.name == ident))\n}\n// Resolve identifiers against a fresh list before expiring.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always list keys before scripting expire operations","Use UIDs, not names, in automation","Verify the login account matches the key owner"],"tags":["api-key","cli","identifier","not-found"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}