zed-industries/zed · error

Failed to get authenticated user. Status: {:?} Body: {body}

Error message

Failed to get authenticated user.
Status: {:?}
Body: {body}

What it means

The authenticated-user check treats 2xx as authenticated and 401 as not authenticated; every other status is an error that includes the status and body. It indicates the cloud API answered abnormally (5xx, gateway error, malformed request) rather than a definitive auth verdict.

Source

Thrown at crates/cloud_api_client/src/cloud_api_client.rs:264

            ),
            AsyncBody::default(),
            Some(&Credentials {
                user_id,
                access_token: access_token.into(),
            }),
        )?;

        let mut response = self.http_client.send(request).await?;

        if response.status().is_success() {
            Ok(true)
        } else {
            let mut body = String::new();
            response.body_mut().read_to_string(&mut body).await?;
            if response.status() == StatusCode::UNAUTHORIZED {
                Ok(false)
            } else {
                Err(anyhow!(
                    "Failed to get authenticated user.\nStatus: {:?}\nBody: {body}",
                    response.status()
                ))
            }
        }
    }

    pub async fn submit_agent_feedback(&self, body: SubmitAgentThreadFeedbackBody) -> Result<()> {
        let request = Request::builder().method(Method::POST).uri(
            self.http_client
                .build_zed_cloud_url("/client/feedback/agent_thread")?
                .as_ref(),
        );

        self.send_authenticated_request(request, AsyncBody::from(serde_json::to_string(&body)?))
            .await?;
        Ok(())
    }

View on GitHub (pinned to bc538def45)

Solutions

  1. Retry after a short wait — transient 5xx values are the most common cause
  2. Check https://status.zed.dev for incidents
  3. If persistent, inspect the body in the error and try signing out and back in to refresh credentials
Defensive patterns

Strategy: retry

Try / catch

let response = self.http_client.send(request).await?;
let status = response.status();
if status.is_server_error() {
    // transient cloud-side failure: safe to retry with backoff
    backoff.wait().await;
    return self.authenticated_user().await;
}
if !status.is_success() && status != StatusCode::UNAUTHORIZED {
    anyhow::bail!("Failed to get authenticated user.\nStatus: {status:?}\nBody: {body}");
}

Prevention

When it happens

Trigger: GET on the authenticated-user endpoint returns something other than 2xx/401: server-side 5xx, 502/504 from a load balancer, or a 400 caused by malformed credentials headers.

Common situations: Cloud API incidents; environments with an intercepting proxy that mangles requests; corrupted stored credentials producing non-standard responses.

Understand the failure class

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/7d6c84ec8f3c5a42. Report an issue: GitHub.