zed-industries/zed · error

No organization selected.

Error message

No organization selected.

What it means

Sentinel guard in Zed Cloud's cached_token: the auth layer requires an organization scope for token retrieval, but user_store.current_organization() returned None, so no token can be cached or fetched. Fires when the user is signed in without an active organization or not signed in at all.

Source

Thrown at crates/language_models/src/provider/cloud.rs:59

    type AuthContext = Option<OrganizationId>;

    fn auth_context(&self, cx: &impl AppContext) -> Self::AuthContext {
        self.user_store.read_with(cx, |user_store, _| {
            user_store
                .current_organization()
                .map(|organization| organization.id.clone())
        })
    }

    fn cached_token(
        &self,
        organization_id: Self::AuthContext,
    ) -> BoxFuture<'static, Result<String>> {
        let client = self.client.clone();
        let llm_api_token = self.llm_api_token.clone();
        Box::pin(async move {
            let organization_id =
                organization_id.ok_or_else(|| anyhow!("No organization selected."))?;
            client
                .cached_llm_token(&llm_api_token, organization_id)
                .await
        })
    }

    fn refresh_token(
        &self,
        organization_id: Self::AuthContext,
    ) -> BoxFuture<'static, Result<String>> {
        let client = self.client.clone();
        let llm_api_token = self.llm_api_token.clone();
        Box::pin(async move {
            let organization_id =
                organization_id.ok_or_else(|| anyhow!("No organization selected."))?;
            client
                .refresh_llm_token(&llm_api_token, organization_id)
                .await

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Sign in to Zed Cloud and select/switch to an organization before using cloud models
  2. Re-authenticate if the session lost its organization membership
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/language_models/src/provider/cloud.rs:59 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20). Data as JSON: /api/errors/80eb5b45479380ed. Report an issue: GitHub.