aaif-goose/goose · error
Could not resolve model config: {error}
Error message
Could not resolve model config: {error} What it means
Reply-path final fallback: with provider and model names from global config, model_config_from_user_config still failed and its {error} is wrapped here. The payload names the actual failure — usually an unresolvable provider id or a malformed custom provider definition, since the names were present but couldn't be turned into a working ModelConfig.
Source
Thrown at crates/goose/src/agents/agent.rs:1775
}
}
Ok(None) => {}
Err(e) => tracing::warn!("Failed to generate session description: {}", e),
}
});
}
let model_config = match entry_session.model_config {
Some(model_config) => model_config,
None => {
let provider_name = Config::global()
.get_goose_provider()
.map_err(|_| anyhow!("Could not resolve model config: missing provider"))?;
let model_name = Config::global()
.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(|error| anyhow!("Could not resolve model config: {error}"))?
}
};
let context_limit = provider
.get_context_limit(&model_config)
.await
.unwrap_or_else(|_| model_config.context_limit());
let steer_queue = self.steer_queue(&session_id).await;
let machine = self.create_state_machine(
provider,
model_config,
context_limit,
session_config.max_turns,
cancel.clone(),
steer_queue,
);
let reply_span = tracing::Span::current();
View on GitHub (pinned to 3810898a74)
Solutions
- Read the wrapped {error} — it states exactly why construction failed
- Match the provider id against `goose configure` options
- Fix or complete custom provider entries in config.yaml
- Update goose so recently added providers resolve
Example fix
# before GOOSE_PROVIDER=anthropic-claude GOOSE_MODEL=claude-sonnet-4-5 goose session Error: Could not resolve model config: ... # after GOOSE_PROVIDER=anthropic GOOSE_MODEL=claude-sonnet-4-5 goose session
Defensive patterns
Strategy: try-catch
Validate before calling
let (p, m) = (
goose::config::Config::global().get_goose_provider()?,
goose::config::Config::global().get_goose_model()?,
);
if goose::model_config::model_config_from_user_config(&p, &m).is_err() {
anyhow::bail!("cannot build model config from {p}/{m} — check provider id");
} Type guard
fn model_config_failed(e: &anyhow::Error) -> bool {
let s = e.to_string();
s.starts_with("Could not resolve model config")
&& !s.contains("missing provider")
&& !s.contains("missing model")
} Try / catch
match agent.reply(msg, session_config, token).await {
Err(e) if model_config_failed(&e) => {
// provider id invalid; stop and reconfigure rather than retrying
anyhow::bail!("invalid provider/model config: {e}");
}
other => other?,
} Prevention
- Verify provider ids exist in the current goose version before deploying
- Include a config smoke-test (build the ModelConfig) in startup health checks
- Upgrade goose and provider CLIs together
When it happens
Trigger: GOOSE_PROVIDER value doesn't match any built-in/configured provider; custom OpenAI-compatible provider entry in config.yaml is malformed; provider id requires a newer goose version.
Common situations: Typos or renamed provider ids across goose versions; copied config files referencing custom providers that aren't defined on this machine.
Related errors
- Could not resolve model config: {e}
- Provider not set
- Could not resolve model config: missing provider
- Provider '{}' has dynamic_models: false but no static models
- Invalid base URL '{}': {}
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/30ae11dea2cd24c5.
Report an issue: GitHub.