{"record":{"id":"1532b3c2746cc0c4","repo":"aaif-goose/goose","slug":"could-not-configure-agent-missing-model","errorCode":null,"errorMessage":"Could not configure agent: missing model","messagePattern":"Could not configure agent: missing model","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose/src/agents/agent.rs","lineNumber":3556,"sourceCode":"    /// Restore the provider from session data or fall back to global config\n    /// This is used when resuming a session to restore the provider state\n    /// 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        }","sourceCodeStart":3538,"sourceCodeEnd":3574,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose/src/agents/agent.rs#L3538-L3574","documentation":"Thrown by Agent::restore_provider_from_session when the resumed session has no saved model_config and the global config cannot supply a model name (config.get_goose_model() fails). A provider was resolved, but a model is required to build the ModelConfig, so restore aborts.","triggerScenarios":"Resuming a session whose session file lacks model_config (older sessions) while GOOSE_MODEL is unset in config.yaml and the environment; or resuming after the config file was reset.","commonSituations":"Fresh installs where 'goose configure' was skipped and only GOOSE_PROVIDER was set by hand; sessions created before model_config persistence was added; CI/embedded environments that export GOOSE_PROVIDER but not GOOSE_MODEL.","solutions":["Set the model: 'goose configure' or 'export GOOSE_MODEL=<model>' and resume again","Check ~/.config/goose/config.yaml contains GOOSE_MODEL","Resume a newer session that persisted its model_config, or start a new session"],"exampleFix":"# before\n$ export GOOSE_PROVIDER=openai\n$ goose session resume\nError: Could not configure agent: missing model\n\n# after\n$ export GOOSE_MODEL=gpt-4o\n$ goose session resume","handlingStrategy":"validation","validationCode":"// Rust — ensure a model will be resolvable before restore\nlet has_model = session.model_config.is_some()\n    || Config::global().get_goose_model().is_ok();\nif !has_model {\n    // set GOOSE_MODEL before calling restore_provider_from_session\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set GOOSE_MODEL together with GOOSE_PROVIDER — they are checked as a pair on restore","Keep at least one configured model in config.yaml for fallback paths"],"tags":["configuration","session-restore","model"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}