aaif-goose/goose · error

Could not configure agent: missing model

Error message

Could not configure agent: missing model

What it means

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.

Source

Thrown at crates/goose/src/agents/agent.rs:3556

    /// Restore the provider from session data or fall back to global config
    /// This is used when resuming a session to restore the provider state
    /// Returns true if the session's provider was replaced with a fallback.
    pub async fn restore_provider_from_session(&self, session: &Session) -> Result<bool> {
        let config = Config::global();

        let provider_name = session
            .provider_name
            .clone()
            .or_else(|| config.get_goose_provider().ok())
            .ok_or_else(|| anyhow!("Could not configure agent: missing provider"))?;

        let mut model_config = match session.model_config.clone() {
            Some(saved_config) => saved_config,
            None => {
                let model_name = config
                    .get_goose_model()
                    .ok()
                    .ok_or_else(|| anyhow!("Could not configure agent: missing model"))?;
                crate::model_config::model_config_from_user_config(&provider_name, &model_name)
                    .map_err(|e| anyhow!("Could not configure agent: invalid model {}", e))?
            }
        };

        // if the saved model is the ACP sentinel "current", only preserve this if the provider
        // uses this sentinel to indicate it's an ACP provider that manages its model
        if model_config.model_name == crate::acp::ACP_CURRENT_MODEL {
            if let Ok(entry) = crate::providers::get_from_registry(&provider_name).await {
                if entry.metadata().default_model != crate::acp::ACP_CURRENT_MODEL {
                    model_config = crate::model_config::model_config_from_user_config(
                        &provider_name,
                        &entry.metadata().default_model,
                    )
                    .map_err(|e| anyhow!("Could not resolve default model: {}", e))?;
                }
            }
        }

View on GitHub (pinned to 3810898a74)

Solutions

  1. Set the model: 'goose configure' or 'export GOOSE_MODEL=<model>' and resume again
  2. Check ~/.config/goose/config.yaml contains GOOSE_MODEL
  3. Resume a newer session that persisted its model_config, or start a new session

Example fix

# before
$ export GOOSE_PROVIDER=openai
$ goose session resume
Error: Could not configure agent: missing model

# after
$ export GOOSE_MODEL=gpt-4o
$ goose session resume
Defensive patterns

Strategy: validation

Validate before calling

// Rust — ensure a model will be resolvable before restore
let has_model = session.model_config.is_some()
    || Config::global().get_goose_model().is_ok();
if !has_model {
    // set GOOSE_MODEL before calling restore_provider_from_session
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/1532b3c2746cc0c4. Report an issue: GitHub.