aaif-goose/goose · error
Failed to create model configuration: {e}
Error message
Failed to create model configuration: {e} What it means
build_switched_model_config rebuilds a ModelConfig from user configuration for a provider/model pair when the user switches models (e.g. the /model command), carrying over temperature and toolshim settings. Any failure from model_config_from_user_config — unknown provider, unresolvable model, inconsistent config — is wrapped as 'Failed to create model configuration: {e}'.
Source
Thrown at crates/goose-cli/src/session/mod.rs:2756
let minutes = total_secs / 60;
let seconds = total_secs % 60;
format!("{}m {:02}s", minutes, seconds)
}
}
fn build_switched_model_config(
provider_name: &str,
model_name: &str,
current_model_config: &goose_providers::model::ModelConfig,
) -> Result<goose_providers::model::ModelConfig> {
goose::model_config::model_config_from_user_config(provider_name, model_name)
.map(|config| {
config
.with_temperature(current_model_config.temperature)
.with_toolshim(current_model_config.toolshim)
.with_toolshim_model(current_model_config.toolshim_model.clone())
})
.map_err(|e| anyhow::anyhow!("Failed to create model configuration: {e}"))
}
#[cfg(test)]
mod tests {
use super::*;
use goose::agents::extension::Envs;
use goose::config::ExtensionConfig;
use std::collections::HashMap;
use std::time::Duration;
use test_case::test_case;
#[test]
fn planner_classification_excludes_user_only_content() {
use rmcp::model::{Annotations, Role, TextContent};
let user_only = TextContent::new("user-only plan")
.with_annotations(Annotations::default().with_audience(vec![Role::User]));
let assistant_only = TextContent::new("agent classification text")View on GitHub (pinned to 3810898a74)
Solutions
- Run goose configure and re-select a valid provider and model
- Verify the exact provider and model ids before switching (goose configure -> view)
- Keep GOOSE_PROVIDER and GOOSE_MODEL consistent when set via environment
Example fix
# before /model openai/gpt-9-turbo # unknown model id # after /model openai/gpt-4o
Defensive patterns
Strategy: validation
Validate before calling
let known = goose::model_config::known_models(); // or list from configure
assert!(
known.contains(&(provider_name, model_name)),
"unknown provider/model pair: {}/{}",
provider_name,
model_name
); Try / catch
if let Err(e) = switch_model(&provider, &model).await {
if e.to_string().contains("Failed to create model configuration") {
eprintln!("run 'goose configure' to pick a valid provider/model");
}
return Err(e);
} Prevention
- Run goose configure after adding providers instead of hand-editing config
- Copy provider and model ids exactly from the configure view
- Keep GOOSE_PROVIDER/GOOSE_MODEL env overrides in sync with config
When it happens
Trigger: Switching to a provider/model goose cannot resolve from configuration: /model someprovider/nonexistent-model, or a provider whose entries are missing after manual config edits.
Common situations: Typos in model ids; provider never configured via goose configure; hand-edited config files left inconsistent; env overrides (GOOSE_PROVIDER/GOOSE_MODEL) conflicting.
Related errors
- OAuth authentication failed for {}: {}
- Failed to create provider for OAuth: {}
- provider check failed
- {label} subprocess exited with status {}: {}
- No command provided in extension string
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/70565b263ca3eab8.
Report an issue: GitHub.