aaif-goose/goose · error

Could not configure agent: invalid model {}

Error message

Could not configure agent: invalid model {}

What it means

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.

Source

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

    /// 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))?;
                }
            }
        }

        let extensions =

View on GitHub (pinned to 3810898a74)

Solutions

  1. Read the '{}' detail: it names the offending key (e.g. 'GOOSE_TEMPERATURE is out of valid range')
  2. Fix or delete the invalid key in ~/.config/goose/config.yaml, then resume again
  3. Run 'goose configure' to regenerate known-good settings
  4. Prefer deleting the key over guessing a value; goose applies defaults when keys are absent

Example fix

# before (~/.config/goose/config.yaml)
GOOSE_TEMPERATURE: -0.5

# after
GOOSE_TEMPERATURE: 0.5   # or remove the key entirely
Defensive patterns

Strategy: validation

Validate before calling

// Rust — pre-validate the global params model_config_from_user_config reads
fn model_config_params_valid() -> Result<()> {
    if let Ok(t) = Config::global().get_param::<f32>("GOOSE_TEMPERATURE") {
        if t < 0.0 { anyhow::bail!("GOOSE_TEMPERATURE must be >= 0"); }
    }
    if let Ok(v) = Config::global().get_param::<serde_yaml::Value>("GOOSE_TOOLSHIM") {
        v.as_bool().context("GOOSE_TOOLSHIM must be a boolean")?;
    }
    Ok(())
}

Prevention

When it happens

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

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

Related errors


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