{"record":{"id":"f53084250513a39a","repo":"aaif-goose/goose","slug":"could-not-configure-agent-invalid-model","errorCode":null,"errorMessage":"Could not configure agent: invalid model {}","messagePattern":"Could not configure agent: invalid model (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose/src/agents/agent.rs","lineNumber":3558,"sourceCode":"    /// Returns true if the session's provider was replaced with a fallback.\n    pub async fn restore_provider_from_session(&self, session: &Session) -> Result<bool> {\n        let config = Config::global();\n\n        let provider_name = session\n            .provider_name\n            .clone()\n            .or_else(|| config.get_goose_provider().ok())\n            .ok_or_else(|| anyhow!(\"Could not configure agent: missing provider\"))?;\n\n        let mut model_config = match session.model_config.clone() {\n            Some(saved_config) => saved_config,\n            None => {\n                let model_name = config\n                    .get_goose_model()\n                    .ok()\n                    .ok_or_else(|| anyhow!(\"Could not configure agent: missing model\"))?;\n                crate::model_config::model_config_from_user_config(&provider_name, &model_name)\n                    .map_err(|e| anyhow!(\"Could not configure agent: invalid model {}\", e))?\n            }\n        };\n\n        // if the saved model is the ACP sentinel \"current\", only preserve this if the provider\n        // uses this sentinel to indicate it's an ACP provider that manages its model\n        if model_config.model_name == crate::acp::ACP_CURRENT_MODEL {\n            if let Ok(entry) = crate::providers::get_from_registry(&provider_name).await {\n                if entry.metadata().default_model != crate::acp::ACP_CURRENT_MODEL {\n                    model_config = crate::model_config::model_config_from_user_config(\n                        &provider_name,\n                        &entry.metadata().default_model,\n                    )\n                    .map_err(|e| anyhow!(\"Could not resolve default model: {}\", e))?;\n                }\n            }\n        }\n\n        let extensions =","sourceCodeStart":3540,"sourceCodeEnd":3576,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose/src/agents/agent.rs#L3540-L3576","documentation":"Thrown when model_config_from_user_config(provider, model) fails while rebuilding the model config during session restore (no saved model_config). The '{}' carries the underlying error from crates/goose/src/model_config.rs: typically an invalid global parameter such as a negative GOOSE_TEMPERATURE, an unparsable GOOSE_TOOLSHIM, or malformed GOOSE_MAX_TOKENS / GOOSE_CONTEXT_LIMIT values.","triggerScenarios":"Resuming a session without saved model_config while any model-related global config key is invalid, e.g. GOOSE_TEMPERATURE: -0.5 in config.yaml, GOOSE_TOOLSHIM set to a non-boolean, or GOOSE_MAX_TOKENS set to a non-numeric string.","commonSituations":"Hand-edited config.yaml with typos; copying config snippets from tutorials with wrong units or signs; keys left behind by experiments; environment variables overriding config with malformed values.","solutions":["Read the '{}' detail: it names the offending key (e.g. 'GOOSE_TEMPERATURE is out of valid range')","Fix or delete the invalid key in ~/.config/goose/config.yaml, then resume again","Run 'goose configure' to regenerate known-good settings","Prefer deleting the key over guessing a value; goose applies defaults when keys are absent"],"exampleFix":"# before (~/.config/goose/config.yaml)\nGOOSE_TEMPERATURE: -0.5\n\n# after\nGOOSE_TEMPERATURE: 0.5   # or remove the key entirely","handlingStrategy":"validation","validationCode":"// Rust — pre-validate the global params model_config_from_user_config reads\nfn model_config_params_valid() -> Result<()> {\n    if let Ok(t) = Config::global().get_param::<f32>(\"GOOSE_TEMPERATURE\") {\n        if t < 0.0 { anyhow::bail!(\"GOOSE_TEMPERATURE must be >= 0\"); }\n    }\n    if let Ok(v) = Config::global().get_param::<serde_yaml::Value>(\"GOOSE_TOOLSHIM\") {\n        v.as_bool().context(\"GOOSE_TOOLSHIM must be a boolean\")?;\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit numeric config keys; use 'goose configure'","Delete experimental keys instead of leaving malformed values behind","Run a resume smoke test after changing config.yaml"],"tags":["configuration","model","validation","session-restore"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}