{"record":{"id":"7ec32bb5a05e1d6b","repo":"zed-industries/zed","slug":"no-models-available","errorCode":null,"errorMessage":"No models available","messagePattern":"No models available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent/src/agent.rs","lineNumber":2401,"sourceCode":"    let Some(rest) = trimmed_start.strip_prefix('/') else {\n        return text.to_string();\n    };\n    rest.split_once(char::is_whitespace)\n        .map(|(_, after)| after.to_string())\n        .unwrap_or_default()\n}\n\nstruct NativeAgentModelSelector {\n    session_id: acp::SessionId,\n    connection: NativeAgentConnection,\n}\n\nimpl acp_thread::AgentModelSelector for NativeAgentModelSelector {\n    fn list_models(&self, cx: &mut App) -> Task<Result<acp_thread::AgentModelList>> {\n        log::debug!(\"NativeAgentConnection::list_models called\");\n        let list = self.connection.0.read(cx).models.model_list.clone();\n        Task::ready(if list.is_empty() {\n            Err(anyhow::anyhow!(\"No models available\"))\n        } else {\n            Ok(list)\n        })\n    }\n\n    fn select_model(&self, model_id: AgentModelId, cx: &mut App) -> Task<Result<()>> {\n        log::debug!(\n            \"Setting model for session {}: {}\",\n            self.session_id,\n            model_id\n        );\n        let Some(thread) = self\n            .connection\n            .0\n            .read(cx)\n            .sessions\n            .get(&self.session_id)\n            .map(|session| session.thread.clone())","sourceCodeStart":2383,"sourceCodeEnd":2419,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent/src/agent.rs#L2383-L2419","documentation":"NativeAgentModelSelector::list_models clones the cached model_list from the agent's models registry; if it is empty the call fails with 'No models available'. The list is populated from configured providers, so emptiness means no language models were configured or enumerated in this agent process.","triggerScenarios":"Opening model selection before any provider is configured, before credentials have loaded/enumerated, or when every provider failed to authenticate so the registry stayed empty.","commonSituations":"Fresh install with no API keys; provider credentials expired so model enumeration failed; settings reference providers that are not installed/enabled; selection invoked before the registry finished its initial load.","solutions":["Configure at least one language model provider credential in settings and retry","Verify the model list actually populated (agent settings) before invoking selection","If credentials exist, check provider logs for enumeration/auth failures"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the model registry before opening selection\nlet list = connection.0.read(cx).models.model_list.clone();\nif list.is_empty() {\n    show_setup_notice(\"configure a provider credential first\");\n    return;\n}","typeGuard":"fn has_models(agent: &AgentConnection, cx: &App) -> bool {\n    !agent.0.read(cx).models.model_list.is_empty()\n}","tryCatchPattern":"match selector.list_models(cx).await {\n    Err(error) if error.to_string() == \"No models available\" => {\n        open_provider_settings(); // guide the user to configure credentials\n        Ok(Default::default())\n    }\n    other => other,\n}","preventionTips":["Run onboarding checks that at least one provider credential is configured before first use","Wait for model enumeration to finish before enabling model pickers","Surface provider auth failures early so an empty registry is never a surprise"],"tags":["rust","zed","agent","llm","models","configuration"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}