aaif-goose/goose · error

Provider rejected mode update: {e}

Error message

Provider rejected mode update: {e}

What it means

Agent::update_goose_mode first delegates to provider.update_mode(session_id, mode); if the provider returns an error it is wrapped here and neither the agent's current_goose_mode nor the session's persisted goose_mode is changed. For ACP-backed providers (e.g. claude-code, codex) update_mode fails when the mode-mapping candidates aren't offered by the remote agent ('None of the mode ids [...] are offered by the agent') or when the set-mode ACP request itself fails ('Failed to set mode: ...').

Source

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

        *current_provider = Some(provider);

        self.config
            .session_manager
            .clone()
            .update(session_id)
            .provider_name(&provider_name)
            .model_config(model_config)
            .apply()
            .await
            .context("Failed to persist provider config to session")
    }

    pub async fn update_goose_mode(&self, mode: GooseMode, session_id: &str) -> Result<()> {
        if let Some(provider) = self.provider.lock().await.as_ref() {
            provider
                .update_mode(session_id, mode)
                .await
                .map_err(|e| anyhow::anyhow!("Provider rejected mode update: {e}"))?;
        }
        *self.current_goose_mode.lock().await = mode;
        self.config
            .session_manager
            .clone()
            .update(session_id)
            .goose_mode(mode)
            .apply()
            .await
            .context("Failed to persist goose_mode to session")
    }

    pub async fn goose_mode(&self) -> GooseMode {
        *self.current_goose_mode.lock().await
    }

    pub async fn recreate_provider_for_session(
        &self,

View on GitHub (pinned to 3810898a74)

Solutions

  1. Update the ACP agent CLI (claude-code / codex) to a version that offers the mode, then retry
  2. Read the wrapped {e}: 'not offered by the agent' means version/capability gap; 'Failed to set mode' means connection problem — reconnect and retry
  3. Fall back to the previously persisted mode (it is unchanged) and continue the session
  4. Verify custom mode mappings reference ids the agent actually advertises
Defensive patterns

Strategy: try-catch

Validate before calling

// For ACP providers, check the mode is offered before updating:
// (modes advertised by the agent are available on the ACP session state)
if !agent_offers_mode(&session_state, &desired_mode_id) {
    anyhow::bail!("agent does not offer mode {desired_mode_id}; update the agent CLI");
}
agent.update_goose_mode(mode, session_id).await?;

Type guard

fn mode_rejected(e: &anyhow::Error) -> bool {
    e.to_string().contains("Provider rejected mode update")
}

Try / catch

match agent.update_goose_mode(mode, session_id).await {
    Err(e) if mode_rejected(&e) => {
        // previous mode is still active (nothing was persisted) — keep going
        tracing::warn!("mode update rejected, staying on previous mode: {e}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Switching to a GooseMode (typically Smart Mode) whose mapped ids the connected ACP agent doesn't advertise — commonly an outdated claude-code/codex CLI; the ACP session/connection dropped so send_set_mode fails; codex/claude_code provider rejecting the mode for its own reasons.

Common situations: User toggles Smart Mode in the desktop app while the bundled claude-code/codex binary is older than the mode support; connection closed between mode selection and the set-mode request; custom mode mappings in config referencing ids the agent doesn't offer.

Related errors


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