{"record":{"id":"93bf7966d565ecf3","repo":"zed-industries/zed","slug":"admin-user-request-failed","errorCode":null,"errorMessage":"admin user request failed {} - {}","messagePattern":"admin user request failed (.+?) - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/client/src/client.rs","lineNumber":1594,"sourceCode":"        }\n\n        let url = self\n            .http\n            .build_zed_cloud_url(\"/internal/users/impersonate\")?;\n        let request = Request::post(url.as_str())\n            .header(\"Content-Type\", \"application/json\")\n            .header(\"Authorization\", format!(\"Bearer {api_token}\"))\n            .body(\n                serde_json::to_string(&ImpersonateUserBody {\n                    github_login: login,\n                })?\n                .into(),\n            )?;\n\n        let mut response = http.send(request).await?;\n        let mut body = String::new();\n        response.body_mut().read_to_string(&mut body).await?;\n        anyhow::ensure!(\n            response.status().is_success(),\n            \"admin user request failed {} - {}\",\n            response.status().as_u16(),\n            body,\n        );\n        let response: ImpersonateUserResponse = serde_json::from_str(&body)?;\n\n        Ok(Credentials {\n            user_id: response.user_id,\n            access_token: response.access_token,\n        })\n    }\n\n    pub async fn cached_llm_token(\n        &self,\n        llm_token: &LlmApiToken,\n        organization_id: OrganizationId,\n    ) -> Result<String> {","sourceCodeStart":1576,"sourceCodeEnd":1612,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/client/src/client.rs#L1576-L1612","documentation":"The impersonation helper POSTs to /internal/users/impersonate with the admin API token to resolve a staff user's identity; the error embeds the HTTP status and response body, meaning the admin endpoint rejected the impersonation request (invalid token, unknown GitHub login, or missing staff permission).","triggerScenarios":"Thrown at crates/client/src/client.rs:1594 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the ADMIN_API_TOKEN is valid and has impersonation permission","Confirm the GitHub login exists in the Zed cloud user database","Check the response body embedded in the error for the specific server-side rejection reason"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}