{"record":{"id":"7b6435db4ea4f9da","repo":"aaif-goose/goose","slug":"failed-to-propagate-mode-to-provider","errorCode":null,"errorMessage":"Failed to propagate mode to provider: {}","messagePattern":"Failed to propagate mode to provider: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose/src/agents/agent.rs","lineNumber":3658,"sourceCode":"                    .provider_name(&fallback_provider_name)\n                    .model_config(fallback_model_config.clone())\n                    .apply()\n                    .await\n                {\n                    tracing::warn!(\"Failed to update session provider: {}\", e);\n                }\n\n                (fallback_provider, fallback_model_config, true)\n            };\n\n        self.update_provider(provider, active_model_config, &session.id)\n            .await?;\n        // Propagate session mode to the new provider\n        if let Some(provider) = self.provider.lock().await.as_ref() {\n            provider\n                .update_mode(&session.id, session.goose_mode)\n                .await\n                .map_err(|e| anyhow!(\"Failed to propagate mode to provider: {}\", e))?;\n        }\n        *self.current_goose_mode.lock().await = session.goose_mode;\n        Ok(provider_changed)\n    }\n\n    /// Override the system prompt with a custom template\n    pub async fn override_system_prompt(&self, template: String) {\n        let mut prompt_manager = self.prompt_manager.lock().await;\n        prompt_manager.set_system_prompt_override(template);\n    }\n\n    pub async fn clear_system_prompt_override(&self) {\n        let mut prompt_manager = self.prompt_manager.lock().await;\n        prompt_manager.clear_system_prompt_override();\n    }\n\n    pub async fn list_extension_prompts(&self, session_id: &str) -> HashMap<String, Vec<Prompt>> {\n        self.extension_manager","sourceCodeStart":3640,"sourceCodeEnd":3676,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose/src/agents/agent.rs#L3640-L3676","documentation":"Thrown at the end of restore_provider_from_session when propagating the session's saved goose_mode to the newly constructed provider via provider.update_mode() fails. The '{}' is the underlying provider error — commonly a transient API/backend failure or a mode the provider does not support (e.g. a planner-dependent mode on a provider without planner support). Provider creation itself succeeded; only the mode sync failed.","triggerScenarios":"Resuming a session saved with a non-default GOOSE_MODE where the provider rejects or fails the mode update: transient network error during update_mode, ACP backend error, or mode feature unsupported by the provider build.","commonSituations":"Resuming sessions across goose versions where mode semantics changed; flaky network at resume time; providers whose mode handling requires extra backend calls that can fail independently.","solutions":["Retry the resume — transient update_mode failures usually clear","Switch the mode to the default (unset GOOSE_MODE / 'set_mode default') before resuming","Check goose logs for the underlying provider error embedded in '{}'","Update goose if the provider's mode handling changed between the session's creation and now"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust — retry the resume on transient mode-propagation failures, fail fast otherwise\nconst MAX: usize = 3;\nfor attempt in 1..=MAX {\n    match agent.restore_provider_from_session(&session).await {\n        Ok(changed) => break,\n        Err(e) if e.to_string().contains(\"Failed to propagate mode\") && attempt < MAX => {\n            tokio::time::sleep(std::time::Duration::from_secs(2u64 * attempt as u64)).await;\n        }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Resume with the default GOOSE_MODE first, then switch modes after restore","Treat update_mode failures as transient first (network) and persistent second (unsupported mode)"],"tags":["provider","mode","session-restore","transient"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}