zed-industries/zed · error · anyhow::Error

Failed to get Cloud client

Error message

Failed to get Cloud client

What it means

In handle_message_to_client (UserUpdated event), the code tried to obtain the global cloud Client entity via an upgrade/lookup that returned None; the sentinel error means the client entity was not available at that point (not yet initialized or already torn down), so the user update could not be processed against the cloud client.

Source

Thrown at crates/client/src/user.rs:920

    }

    fn handle_message_to_client(this: WeakEntity<Self>, message: &MessageToClient, cx: &App) {
        match message {
            MessageToClient::UserUpdated => {}
            MessageToClient::NotificationsUpdated => return,
        }

        cx.spawn(async move |cx| {
            let (cloud_client, system_id) = cx
                .update(|cx| {
                    this.read_with(cx, |this, _cx| {
                        this.client.upgrade().map(|client| {
                            let system_id = client.telemetry().system_id().map(|id| id.to_string());
                            (client.cloud_client(), system_id)
                        })
                    })
                })?
                .ok_or(anyhow::anyhow!("Failed to get Cloud client"))?;

            let response = cloud_client.get_authenticated_user(system_id).await?;
            cx.update(|cx| {
                this.update(cx, |this, cx| {
                    this.update_authenticated_user(response, cx);
                })
            })?;

            anyhow::Ok(())
        })
        .detach_and_log_err(cx);
    }

    pub fn watch_current_user(&self) -> watch::Receiver<Option<Arc<User>>> {
        self.current_user.clone()
    }

    fn load_users(

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Retry once the Client global has been initialized at startup
  2. Defer handling user-updated messages until sign-in/cloud client setup completes
  3. Drop the update gracefully if the client is gone during shutdown instead of erroring
Defensive patterns

Strategy: type-guard

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-09-05). Data as JSON: /api/errors/aa64f095c75ab5d9. Report an issue: GitHub.