aaif-goose/goose · error
Could not resolve model config: missing provider
Error message
Could not resolve model config: missing provider
What it means
Agent::model_config_for_session first tries the session's stored model_config; if absent it falls back to global config and requires Config::get_goose_provider() to succeed. This error means neither source has a provider: the session never persisted a model selection AND the global config (~/.config/goose/config.yaml or GOOSE_PROVIDER env) has no provider set.
Source
Thrown at crates/goose/src/agents/agent.rs:961
pub async fn model_config_for_session(
&self,
session_id: &str,
) -> Result<goose_providers::model::ModelConfig> {
if let Ok(session) = self
.config
.session_manager
.get_session(session_id, false)
.await
{
if let Some(model_config) = session.model_config {
return Ok(model_config);
}
}
let config = Config::global();
let provider_name = config
.get_goose_provider()
.map_err(|_| anyhow!("Could not resolve model config: missing provider"))?;
let model_name = config
.get_goose_model()
.map_err(|_| anyhow!("Could not resolve model config: missing model"))?;
crate::model_config::model_config_from_user_config(&provider_name, &model_name)
.map_err(|e| anyhow!("Could not resolve model config: {e}"))
}
/// When set, all stdio extensions will be started via `docker exec` in the specified container.
pub async fn set_container(&self, container: Option<Container>) {
*self.container.lock().await = container.clone();
}
pub async fn container(&self) -> Option<Container> {
self.container.lock().await.clone()
}
/// Check if a tool is a frontend tool
pub async fn is_frontend_tool(&self, name: &str) -> bool {View on GitHub (pinned to 3810898a74)
Solutions
- Run `goose configure` and pick a provider/model
- Export GOOSE_PROVIDER (and GOOSE_MODEL) in the environment
- Once a model is selected in the session, it is persisted as session.model_config and the global fallback is no longer needed
- Check ~/.config/goose/config.yaml exists and contains the keys (correct GOOSE_CONFIG path if overridden)
Example fix
# before $ goose session Error: Could not resolve model config: missing provider # after $ export GOOSE_PROVIDER=anthropic GOOSE_MODEL=claude-sonnet-4-5 $ goose session
Defensive patterns
Strategy: validation
Validate before calling
let config = goose::config::Config::global();
if config.get_goose_provider().is_err() {
anyhow::bail!("no provider configured: run `goose configure` or set GOOSE_PROVIDER");
}
// safe to resolve a model config now Type guard
fn missing_provider_config(e: &anyhow::Error) -> bool {
e.to_string().contains("missing provider")
} Prevention
- Run `goose configure` as part of setup automation
- Persist a model choice into each session so the global fallback is never needed
- Surface config problems at startup, not mid-reply
When it happens
Trigger: Calling model_config_for_session for a session created before any provider was chosen (session.model_config == None) while Config::global().get_goose_provider() returns Err — i.e. the GOOSE_PROVIDER key is missing from config.
Common situations: Fresh install that never ran `goose configure`; CI/headless environment without GOOSE_PROVIDER; a config file that was reset, moved, or is unreadable so keys parse as absent.
Related errors
- Provider not set
- Could not resolve model config: missing model
- Could not resolve model config: {e}
- Could not resolve model config: {error}
- Provider rejected mode update: {e}
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/9c658fdd7a9fc19c.
Report an issue: GitHub.