aaif-goose/goose · error

Could not resolve model config: missing model

Error message

Could not resolve model config: missing model

What it means

Companion of the 'missing provider' error in Agent::model_config_for_session: the session has no stored model_config and the global config resolves a provider but Config::get_goose_model() fails — the GOOSE_MODEL key is absent from config.yaml / environment, so no ModelConfig can be built.

Source

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

    ) -> Result<goose_providers::model::ModelConfig> {
        if let Ok(session) = self
            .config
            .session_manager
            .get_session(session_id, false)
            .await
        {
            if let Some(model_config) = session.model_config {
                return Ok(model_config);
            }
        }

        let config = Config::global();
        let provider_name = config
            .get_goose_provider()
            .map_err(|_| anyhow!("Could not resolve model config: missing provider"))?;
        let model_name = config
            .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(|e| anyhow!("Could not resolve model config: {e}"))
    }

    /// When set, all stdio extensions will be started via `docker exec` in the specified container.
    pub async fn set_container(&self, container: Option<Container>) {
        *self.container.lock().await = container.clone();
    }

    pub async fn container(&self) -> Option<Container> {
        self.container.lock().await.clone()
    }

    /// Check if a tool is a frontend tool
    pub async fn is_frontend_tool(&self, name: &str) -> bool {
        self.frontend_tools.lock().await.contains_key(name)
    }

View on GitHub (pinned to 3810898a74)

Solutions

  1. Run `goose configure` and complete model selection
  2. Export GOOSE_MODEL alongside GOOSE_PROVIDER
  3. Select a model once inside the session so it persists to session.model_config
  4. Inspect config.yaml for a missing/misspelled GOOSE_MODEL key

Example fix

# before
$ export GOOSE_PROVIDER=openai
$ goose session
Error: Could not resolve model config: missing model

# after
$ export GOOSE_PROVIDER=openai GOOSE_MODEL=gpt-5.2
$ goose session
Defensive patterns

Strategy: validation

Validate before calling

let config = goose::config::Config::global();
if config.get_goose_provider().is_ok() && config.get_goose_model().is_err() {
    anyhow::bail!("provider set but GOOSE_MODEL missing — complete `goose configure`");
}

Type guard

fn missing_model_config(e: &anyhow::Error) -> bool {
    e.to_string().contains("missing model")
}

Prevention

When it happens

Trigger: GOOSE_PROVIDER is set but GOOSE_MODEL is not; session.model_config is None (model never persisted to this session) and the model lookup errors.

Common situations: Partial configuration (provider chosen, model left blank); config written by an older goose version or hand-edited and the model key was dropped; CI with only GOOSE_PROVIDER exported.

Related errors


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