zed-industries/zed · error

admin user request failed

Error message

admin user request failed {} - {}

What it means

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).

Solutions

  1. Verify the ADMIN_API_TOKEN is valid and has impersonation permission
  2. Confirm the GitHub login exists in the Zed cloud user database
  3. Check the response body embedded in the error for the specific server-side rejection reason
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/client/src/client.rs:1594 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/93bf7966d565ecf3. Report an issue: GitHub.

Appendix: source

Thrown at crates/client/src/client.rs:1594

        }

        let url = self
            .http
            .build_zed_cloud_url("/internal/users/impersonate")?;
        let request = Request::post(url.as_str())
            .header("Content-Type", "application/json")
            .header("Authorization", format!("Bearer {api_token}"))
            .body(
                serde_json::to_string(&ImpersonateUserBody {
                    github_login: login,
                })?
                .into(),
            )?;

        let mut response = http.send(request).await?;
        let mut body = String::new();
        response.body_mut().read_to_string(&mut body).await?;
        anyhow::ensure!(
            response.status().is_success(),
            "admin user request failed {} - {}",
            response.status().as_u16(),
            body,
        );
        let response: ImpersonateUserResponse = serde_json::from_str(&body)?;

        Ok(Credentials {
            user_id: response.user_id,
            access_token: response.access_token,
        })
    }

    pub async fn cached_llm_token(
        &self,
        llm_token: &LlmApiToken,
        organization_id: OrganizationId,
    ) -> Result<String> {

View on GitHub (pinned to f4178619ac)