warpdotdev/warp · error · anyhow::Error
failed to create API key
Error message
failed to create API key
What it means
Raised when the `generateApiKey` GraphQL mutation returns `GenerateApiKeyResult::Unknown`: the server responded, but the payload matched neither the success output nor a recognized user-facing error variant. It is the generic fallback after structured server errors are handled, and usually indicates client/server schema or version skew.
Source
Thrown at app/src/ai/agent_sdk/api_key.rs:115
async move {
let json_output = args.json_output;
let expires_at = expires_at_from_args(args.expiration)?;
let agent_uid = args.agent_uid.map(cynic::Id::new);
let result = auth_client
.create_api_key(args.name, None, agent_uid, expires_at)
.await?;
let result = match result {
GenerateApiKeyResult::GenerateApiKeyOutput(output) => CreatedApiKeyInfo {
raw_api_key: output.raw_api_key,
api_key: ApiKeyInfo::from(output.api_key),
},
GenerateApiKeyResult::UserFacingError(e) => {
return Err(anyhow!(
warp_graphql::client::get_user_facing_error_message(e)
));
}
GenerateApiKeyResult::Unknown => {
return Err(anyhow!("failed to create API key"));
}
};
print_created_api_key(result, output_format, json_output)?;
Ok(())
},
|_, result: Result<()>, ctx| finish_command(result, ctx),
);
}
fn expire(
&self,
output_format: OutputFormat,
args: ExpireApiKeyArgs,
ctx: &mut ModelContext<Self>,
) {
let key_identifier = args.key_uid;
let force = args.force;
let json_output = args.json_output;View on GitHub (pinned to e72fd7aacb)
Solutions
- Retry the command once — transient gateway/proxy interference can produce Unknown
- Update the Warp CLI/client to a build whose schema matches the server
- Verify the network path (no intercepting proxy) and that auth is valid; re-login if the session expired
- If it persists, check server-side status/logs: the raw payload matched no known variant
Defensive patterns
Strategy: retry
Try / catch
match auth_client.create_api_key(name, None, agent_uid, expires_at).await? {
GenerateApiKeyResult::GenerateApiKeyOutput(output) => Ok(output),
GenerateApiKeyResult::UserFacingError(e) =>
Err(anyhow!(warp_graphql::client::get_user_facing_error_message(e))),
GenerateApiKeyResult::Unknown => {
// Indeterminate response: safe to retry create (server enforces name uniqueness)
// but alert on repetition — sustained Unknown means client/server schema skew.
retry_or_report("unrecognized generateApiKey response; update client and retry")
}
} Prevention
- Keep client and server versions aligned
- Pin CI to a known-good CLI release
- Alert on Unknown results — they signal schema drift
- Wrap mutating key operations in a bounded retry with backoff
When it happens
Trigger: Running `warp api-key create ...`; `auth_client.create_api_key(...)` deserializes to the Unknown variant because of an unexpected response shape, a new unrecognized server error code, or an intermediary (proxy/gateway) altering the response.
Common situations: Client build older than the server's GraphQL schema; staging vs production endpoints; intercepting proxies returning HTML error pages; server incidents producing unrecognized payloads.
Related errors
- failed to expire API key
- Failed to fetch images
- Failed to fetch list of base images
- Server error: did not receive auth URL for OAuth flow
- claude -p exited {result.returncode} stderr: {result.stderr}
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/486fbb0e1dd2dbc0.
Report an issue: GitHub.