{"record":{"id":"b95c0b10633f2df0","repo":"aaif-goose/goose","slug":"could-not-resolve-model-config-e","errorCode":null,"errorMessage":"Could not resolve model config: {e}","messagePattern":"Could not resolve model config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose/src/agents/agent.rs","lineNumber":966,"sourceCode":"            .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\n    /// Get a reference to a frontend tool\n    pub async fn get_frontend_tool(&self, name: &str) -> Option<FrontendTool> {","sourceCodeStart":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose/src/agents/agent.rs#L948-L984","documentation":"Final fallback step of Agent::model_config_for_session: with a provider and model name in hand, model_config_from_user_config(&provider_name, &model_name) still failed. The {e} payload carries the real cause — typically the provider string is not resolvable to a known provider config, so goose cannot build a ModelConfig (context limit, auth requirements, tool support).","triggerScenarios":"GOOSE_PROVIDER holds a value that doesn't match any built-in or configured custom provider; a custom OpenAI-compatible provider entry in config.yaml is malformed; version skew where the provider id was renamed or is only available in a newer goose.","commonSituations":"Typos in GOOSE_PROVIDER (e.g. 'open_ai' vs 'openai'); referencing a recently added provider on an outdated goose binary; broken custom provider definitions under the goose config's custom-providers section.","solutions":["Read the {e} suffix — it names the exact construction failure","Verify the provider id against the list shown by `goose configure` / `goose leaderboard`","Update goose to the latest version so new provider ids resolve","For custom providers, validate the config.yaml entry (base_url, model name, API key reference)"],"exampleFix":"# before\nGOOSE_PROVIDER=open_ai GOOSE_MODEL=gpt-5.2 goose session\nError: Could not resolve model config: ...\n\n# after\nGOOSE_PROVIDER=openai GOOSE_MODEL=gpt-5.2 goose session","handlingStrategy":"try-catch","validationCode":"let provider_name = config.get_goose_provider()?;\n// cheap probe before relying on it in a session:\nif goose::model_config::model_config_from_user_config(&provider_name, &model_name).is_err() {\n    anyhow::bail!(\"provider/model pair not constructible: {provider_name}/{model_name}\");\n}","typeGuard":"fn model_config_failed(e: &anyhow::Error) -> bool {\n    e.to_string().starts_with(\"Could not resolve model config\")\n        && !e.to_string().contains(\"missing provider\")\n        && !e.to_string().contains(\"missing model\")\n}","tryCatchPattern":"match agent.model_config_for_session(&session_id).await {\n    Ok(cfg) => cfg,\n    Err(e) if model_config_failed(&e) => {\n        eprintln!(\"provider/model invalid ({}); run `goose configure`\", e);\n        std::process::exit(2);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate provider ids against `goose configure` before saving them to env/config","Upgrade goose when adopting new provider ids","Log the wrapped {e} — it pinpoints the construction failure"],"tags":["rust","goose","provider","config","validation"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}