{"record":{"id":"cad10e3c3fab3d60","repo":"aaif-goose/goose","slug":"provider-rejected-mode-update-e","errorCode":null,"errorMessage":"Provider rejected mode update: {e}","messagePattern":"Provider rejected mode update: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose/src/agents/agent.rs","lineNumber":3472,"sourceCode":"        *current_provider = Some(provider);\n\n        self.config\n            .session_manager\n            .clone()\n            .update(session_id)\n            .provider_name(&provider_name)\n            .model_config(model_config)\n            .apply()\n            .await\n            .context(\"Failed to persist provider config to session\")\n    }\n\n    pub async fn update_goose_mode(&self, mode: GooseMode, session_id: &str) -> Result<()> {\n        if let Some(provider) = self.provider.lock().await.as_ref() {\n            provider\n                .update_mode(session_id, mode)\n                .await\n                .map_err(|e| anyhow::anyhow!(\"Provider rejected mode update: {e}\"))?;\n        }\n        *self.current_goose_mode.lock().await = mode;\n        self.config\n            .session_manager\n            .clone()\n            .update(session_id)\n            .goose_mode(mode)\n            .apply()\n            .await\n            .context(\"Failed to persist goose_mode to session\")\n    }\n\n    pub async fn goose_mode(&self) -> GooseMode {\n        *self.current_goose_mode.lock().await\n    }\n\n    pub async fn recreate_provider_for_session(\n        &self,","sourceCodeStart":3454,"sourceCodeEnd":3490,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose/src/agents/agent.rs#L3454-L3490","documentation":"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: ...').","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update the ACP agent CLI (claude-code / codex) to a version that offers the mode, then retry","Read the wrapped {e}: 'not offered by the agent' means version/capability gap; 'Failed to set mode' means connection problem — reconnect and retry","Fall back to the previously persisted mode (it is unchanged) and continue the session","Verify custom mode mappings reference ids the agent actually advertises"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// For ACP providers, check the mode is offered before updating:\n// (modes advertised by the agent are available on the ACP session state)\nif !agent_offers_mode(&session_state, &desired_mode_id) {\n    anyhow::bail!(\"agent does not offer mode {desired_mode_id}; update the agent CLI\");\n}\nagent.update_goose_mode(mode, session_id).await?;","typeGuard":"fn mode_rejected(e: &anyhow::Error) -> bool {\n    e.to_string().contains(\"Provider rejected mode update\")\n}","tryCatchPattern":"match agent.update_goose_mode(mode, session_id).await {\n    Err(e) if mode_rejected(&e) => {\n        // previous mode is still active (nothing was persisted) — keep going\n        tracing::warn!(\"mode update rejected, staying on previous mode: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Keep the ACP agent CLIs (claude-code, codex) updated alongside goose","After upgrading, verify Smart Mode works before relying on it","On rejection, remember the old mode remains in effect — don't assume the switch happened","Check mode mappings reference ids the remote agent actually advertises"],"tags":["rust","goose","acp","mode","version-skew","provider"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}