{"record":{"id":"be73e33e82599096","repo":"zed-industries/zed","slug":"no-language-model-configured","errorCode":null,"errorMessage":"no language model configured","messagePattern":"no language model configured","errorType":"exception","errorClass":"NoModelConfiguredError","httpStatus":null,"severity":"error","filePath":"crates/agent/src/thread.rs","lineNumber":2515,"sourceCode":"        T: Into<UserMessageContent>,\n    {\n        let content = content.into_iter().map(Into::into).collect::<Arc<_>>();\n        log::debug!(\"Thread::send content: {:?}\", content);\n\n        self.messages\n            .push(Arc::new(Message::User(UserMessage { id, content })));\n        cx.notify();\n\n        self.send_existing(cx)\n    }\n\n    pub fn send_existing(\n        &mut self,\n        cx: &mut Context<Self>,\n    ) -> Result<mpsc::UnboundedReceiver<Result<ThreadEvent>>> {\n        let model = self\n            .model()\n            .ok_or_else(|| anyhow!(NoModelConfiguredError))?;\n\n        log::info!(\"Thread::send called with model: {}\", model.name().0);\n        self.advance_prompt_id();\n\n        log::debug!(\"Total messages in thread: {}\", self.messages.len());\n        self.run_turn(cx)\n    }\n\n    /// Force a manual context compaction using the summary strategy,\n    /// regardless of the current token usage or context window size.\n    pub fn compact(\n        &mut self,\n        id: ClientUserMessageId,\n        cx: &mut Context<Self>,\n    ) -> Result<mpsc::UnboundedReceiver<Result<ThreadEvent>>> {\n        let model = self\n            .compaction_model(cx)\n            .ok_or_else(|| anyhow!(NoModelConfiguredError))?;","sourceCodeStart":2497,"sourceCodeEnd":2533,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent/src/thread.rs#L2497-L2533","documentation":"Thread::send_existing resolves the language model for the turn via self.model() and returns NoModelConfiguredError ('no language model configured') when that resolution yields None. The model is picked from the thread-level override, the active profile, or the agent default-model setting; if none of them produces a usable model, the turn cannot start.","triggerScenarios":"Calling send or send_existing on a thread where no default model is set in AgentSettings, the thread and active profile carry no model override, or the configured model's provider is signed out or otherwise unavailable so the model id no longer resolves.","commonSituations":"Fresh install where no model was ever selected; the user signed out of the provider or removed its API key; settings.json hand-edited to an invalid model id; a subagent or automated send firing before model selection completes.","solutions":["Select a default language model in the agent settings UI, then resend the prompt","Set a model override on the thread or switch to a profile that has one","Re-authenticate the provider so the configured model resolves again","In embedding code, catch this error and surface a model-picker prompt instead of failing silently"],"exampleFix":"// before\nlet events = thread.update(cx, |thread, cx| thread.send_existing(cx))?;\n\n// after\nif thread.read(cx).model().is_none() {\n    open_model_picker(cx);\n    return Ok(());\n}\nlet events = thread.update(cx, |thread, cx| thread.send_existing(cx))?;","handlingStrategy":"validation","validationCode":"// Run before sending: make sure a model resolves for this thread.\nfn has_configured_model(thread: &Entity<Thread>, cx: &App) -> bool {\n    thread.read(cx).model().is_some()\n}","typeGuard":"fn resolved_model(\n    thread: &Entity<Thread>,\n    cx: &App,\n) -> Option<Arc<dyn LanguageModel>> {\n    thread.read(cx).model().cloned()\n}","tryCatchPattern":"let events = match thread.update(cx, |thread, cx| thread.send_existing(cx)) {\n    Ok(events) => events,\n    Err(err) if err.is::<NoModelConfiguredError>() => {\n        open_model_picker(cx);\n        return Ok(());\n    }\n    Err(err) => return Err(err),\n};","preventionTips":["Set an explicit default model in agent settings for every profile you use","Assert model().is_some() in tests and tooling that drive threads headlessly","Re-check model resolution after provider sign-out or settings import","Catch NoModelConfiguredError at the UI boundary and prompt for model selection"],"tags":["rust","agent","configuration","language-model","settings"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}