{"record":{"id":"486fbb0e1dd2dbc0","repo":"warpdotdev/warp","slug":"failed-to-create-api-key","errorCode":null,"errorMessage":"failed to create API key","messagePattern":"failed to create API key","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/api_key.rs","lineNumber":115,"sourceCode":"            async move {\n                let json_output = args.json_output;\n                let expires_at = expires_at_from_args(args.expiration)?;\n                let agent_uid = args.agent_uid.map(cynic::Id::new);\n                let result = auth_client\n                    .create_api_key(args.name, None, agent_uid, expires_at)\n                    .await?;\n                let result = match result {\n                    GenerateApiKeyResult::GenerateApiKeyOutput(output) => CreatedApiKeyInfo {\n                        raw_api_key: output.raw_api_key,\n                        api_key: ApiKeyInfo::from(output.api_key),\n                    },\n                    GenerateApiKeyResult::UserFacingError(e) => {\n                        return Err(anyhow!(\n                            warp_graphql::client::get_user_facing_error_message(e)\n                        ));\n                    }\n                    GenerateApiKeyResult::Unknown => {\n                        return Err(anyhow!(\"failed to create API key\"));\n                    }\n                };\n                print_created_api_key(result, output_format, json_output)?;\n                Ok(())\n            },\n            |_, result: Result<()>, ctx| finish_command(result, ctx),\n        );\n    }\n\n    fn expire(\n        &self,\n        output_format: OutputFormat,\n        args: ExpireApiKeyArgs,\n        ctx: &mut ModelContext<Self>,\n    ) {\n        let key_identifier = args.key_uid;\n        let force = args.force;\n        let json_output = args.json_output;","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/api_key.rs#L97-L133","documentation":"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.","triggerScenarios":"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.","commonSituations":"Client build older than the server's GraphQL schema; staging vs production endpoints; intercepting proxies returning HTML error pages; server incidents producing unrecognized payloads.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match auth_client.create_api_key(name, None, agent_uid, expires_at).await? {\n    GenerateApiKeyResult::GenerateApiKeyOutput(output) => Ok(output),\n    GenerateApiKeyResult::UserFacingError(e) =>\n        Err(anyhow!(warp_graphql::client::get_user_facing_error_message(e))),\n    GenerateApiKeyResult::Unknown => {\n        // Indeterminate response: safe to retry create (server enforces name uniqueness)\n        // but alert on repetition — sustained Unknown means client/server schema skew.\n        retry_or_report(\"unrecognized generateApiKey response; update client and retry\")\n    }\n}","preventionTips":["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"],"tags":["api-key","graphql","server","version-skew","auth"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}