zed-industries/zed · error

Provider not found

Error message

Provider not found

What it means

The thread has a model, but its provider_id is absent from the global LanguageModelRegistry. map_language_model_to_info needs the provider for metadata and display info, so the request fails even though the model id itself is known.

Source

Thrown at crates/agent/src/agent.rs:2493

    }

    fn selected_model(&self, cx: &mut App) -> Task<Result<acp_thread::AgentModelInfo>> {
        let Some(thread) = self
            .connection
            .0
            .read(cx)
            .sessions
            .get(&self.session_id)
            .map(|session| session.thread.clone())
        else {
            return Task::ready(Err(anyhow!("Session not found")));
        };
        let Some(model) = thread.read(cx).model() else {
            return Task::ready(Err(anyhow!("Model not found")));
        };
        let Some(provider) = LanguageModelRegistry::read_global(cx).provider(&model.provider_id())
        else {
            return Task::ready(Err(anyhow!("Provider not found")));
        };
        Task::ready(Ok(LanguageModels::map_language_model_to_info(
            model, &provider,
        )))
    }

    fn favorite_model_ids(&self, cx: &mut App) -> HashSet<AgentModelId> {
        agent_settings::AgentSettings::get_global(cx)
            .favorite_model_ids()
            .into_iter()
            .map(AgentModelId::from)
            .collect()
    }

    fn toggle_favorite_model(&self, model_id: AgentModelId, should_be_favorite: bool, cx: &App) {
        let selection = model_id_to_selection(&model_id, cx);
        let fs = self.connection.0.read(cx).fs.clone();
        update_settings_file(fs, cx, move |settings, _| {

View on GitHub (pinned to bc538def45)

Solutions

  1. Enable or sign in to the provider the model belongs to, or switch the thread model to one from an active provider.
  2. If it happens at startup, re-query after the registry finishes loading (observe LanguageModelRegistry for changes).
  3. Prune stale model ids from settings (favorite_model_ids / default_model) that point at removed providers.

Example fix

// before
let info = connection.selected_model(cx).await?; // "Provider not found"

// after
let model = thread.read(cx).model().unwrap(); // guarded earlier
let provider_ok = LanguageModelRegistry::read_global(cx)
    .provider(&model.provider_id())
    .is_some();
if !provider_ok { /* pick another model */ }
Defensive patterns

Strategy: validation

Validate before calling

let Some(model) = thread.read(cx).model() else { return };
let provider_available = LanguageModelRegistry::read_global(cx)
    .provider(&model.provider_id())
    .is_some();
if !provider_available {
    // choose a model whose provider is registered, or defer until registry loads
}

Type guard

fn provider_registered(provider_id: &LanguageModelProviderId, cx: &App) -> bool {
    LanguageModelRegistry::read_global(cx).provider(provider_id).is_some()
}

Prevention

When it happens

Trigger: The model references a provider that is disabled, signed out, not yet loaded, or removed; querying selected_model during startup before providers have registered in LanguageModelRegistry.

Common situations: Settings synced from another machine referencing an unavailable provider; signing out of hosted models; disabling a provider extension; init-time races before the registry populates.

Related errors


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