{"record":{"id":"22ab2beb335a3561","repo":"aaif-goose/goose","slug":"could-not-resolve-model-config-missing-model","errorCode":null,"errorMessage":"Could not resolve model config: missing model","messagePattern":"Could not resolve model config: missing model","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose/src/agents/agent.rs","lineNumber":964,"sourceCode":"    ) -> Result<goose_providers::model::ModelConfig> {\n        if let Ok(session) = self\n            .config\n            .session_manager\n            .get_session(session_id, false)\n            .await\n        {\n            if let Some(model_config) = session.model_config {\n                return Ok(model_config);\n            }\n        }\n\n        let config = Config::global();\n        let provider_name = config\n            .get_goose_provider()\n            .map_err(|_| anyhow!(\"Could not resolve model config: missing provider\"))?;\n        let model_name = config\n            .get_goose_model()\n            .map_err(|_| anyhow!(\"Could not resolve model config: missing model\"))?;\n        crate::model_config::model_config_from_user_config(&provider_name, &model_name)\n            .map_err(|e| anyhow!(\"Could not resolve model config: {e}\"))\n    }\n\n    /// When set, all stdio extensions will be started via `docker exec` in the specified container.\n    pub async fn set_container(&self, container: Option<Container>) {\n        *self.container.lock().await = container.clone();\n    }\n\n    pub async fn container(&self) -> Option<Container> {\n        self.container.lock().await.clone()\n    }\n\n    /// Check if a tool is a frontend tool\n    pub async fn is_frontend_tool(&self, name: &str) -> bool {\n        self.frontend_tools.lock().await.contains_key(name)\n    }\n","sourceCodeStart":946,"sourceCodeEnd":982,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose/src/agents/agent.rs#L946-L982","documentation":"Companion of the 'missing provider' error in Agent::model_config_for_session: the session has no stored model_config and the global config resolves a provider but Config::get_goose_model() fails — the GOOSE_MODEL key is absent from config.yaml / environment, so no ModelConfig can be built.","triggerScenarios":"GOOSE_PROVIDER is set but GOOSE_MODEL is not; session.model_config is None (model never persisted to this session) and the model lookup errors.","commonSituations":"Partial configuration (provider chosen, model left blank); config written by an older goose version or hand-edited and the model key was dropped; CI with only GOOSE_PROVIDER exported.","solutions":["Run `goose configure` and complete model selection","Export GOOSE_MODEL alongside GOOSE_PROVIDER","Select a model once inside the session so it persists to session.model_config","Inspect config.yaml for a missing/misspelled GOOSE_MODEL key"],"exampleFix":"# before\n$ export GOOSE_PROVIDER=openai\n$ goose session\nError: Could not resolve model config: missing model\n\n# after\n$ export GOOSE_PROVIDER=openai GOOSE_MODEL=gpt-5.2\n$ goose session","handlingStrategy":"validation","validationCode":"let config = goose::config::Config::global();\nif config.get_goose_provider().is_ok() && config.get_goose_model().is_err() {\n    anyhow::bail!(\"provider set but GOOSE_MODEL missing — complete `goose configure`\");\n}","typeGuard":"fn missing_model_config(e: &anyhow::Error) -> bool {\n    e.to_string().contains(\"missing model\")\n}","tryCatchPattern":null,"preventionTips":["Always set provider and model together (env pairs or `goose configure`)","Add a startup config assertion in embedded setups","Persist the selection to the session on first use"],"tags":["rust","goose","config","model-selection"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}