warpdotdev/warp · error · anyhow::Error
failed to expire API key
Error message
failed to expire API key
What it means
Generic fallback when the `expireApiKey` GraphQL mutation returns `ExpireApiKeyResult::Unknown`: the server responded but the payload matched neither the success output nor a recognized user-facing error, so the CLI cannot tell whether the key was actually expired.
Source
Thrown at app/src/ai/agent_sdk/api_key.rs:215
ctx.terminate_app(TerminationMode::ForceTerminate, None);
return;
}
}
let uid = ApiKeyUid::from(key.uid);
let auth_client = ServerApiProvider::as_ref(ctx).get_auth_client();
ctx.spawn(
async move {
let result = auth_client.expire_api_key(&uid).await?;
let expired = match result {
ExpireApiKeyResult::ExpireApiKeyOutput(output) => output.success,
ExpireApiKeyResult::UserFacingError(e) => {
return Err(anyhow!(
warp_graphql::client::get_user_facing_error_message(e)
));
}
ExpireApiKeyResult::Unknown => {
return Err(anyhow!("failed to expire API key"))
}
};
print_expire_api_key_result(
uid.to_string(),
expired,
output_format,
json_output,
)?;
Ok(())
},
|_, result: Result<()>, ctx| finish_command(result, ctx),
);
},
);
}
}
impl warpui::Entity for ApiKeyCommandRunner {View on GitHub (pinned to e72fd7aacb)
Solutions
- Check the key's actual state with `warp api-key list` — the expire may or may not have been applied
- Retry the expire command: expiring an already-expired key is idempotent server-side
- Update the client to a build matching the server schema
- If Unknown persists, check server status/logs
Defensive patterns
Strategy: retry
Try / catch
match auth_client.expire_api_key(&uid).await? {
ExpireApiKeyResult::ExpireApiKeyOutput(output) => Ok(output.success),
ExpireApiKeyResult::UserFacingError(e) =>
Err(anyhow!(warp_graphql::client::get_user_facing_error_message(e))),
ExpireApiKeyResult::Unknown => {
// Expire is idempotent: verify via list_api_keys, then retry once.
verify_then_retry(&uid)
}
} Prevention
- Treat Unknown as indeterminate: re-list keys to confirm state
- Expire is idempotent — retrying is safe
- Keep client/server schema versions aligned
When it happens
Trigger: Running `warp api-key expire <uid> [--force]`; `auth_client.expire_api_key(&uid)` deserializes to Unknown because of schema skew, an unrecognized server error code, or an intermediary altering the response.
Common situations: Client/server version mismatch; auth token invalid mid-flight; proxies rewriting responses; server-side incidents.
Related errors
- failed to create API key
- Server error: did not receive auth URL for OAuth flow
- Unexpected OAuth status
- Refusing to expire API key without confirmation in non-inter
- API key '{key_identifier}' not found
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/16544c8727491bca.
Report an issue: GitHub.