{"record":{"id":"f22e90f42dc9a8d6","repo":"langchain-ai/deepagents","slug":"manual-approval-mode-could-not-be-persisted-graph","errorCode":null,"errorMessage":"Manual approval mode could not be persisted; graph execution is blocked until the Store is available.","messagePattern":"Manual approval mode could not be persisted; graph execution is blocked until the Store is available\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/tui/textual_adapter.py","lineNumber":1939,"sourceCode":"                            agent,\n                            thread_id,\n                            mode=ApprovalMode.MANUAL,\n                        )\n                    )\n                except Exception as exc:\n                    context[\"approval_mode\"] = ApprovalMode.MANUAL.value\n                    context[\"auto_approve\"] = False\n                    context.pop(\"approval_mode_key\", None)\n                    session_state.approval_mode = ApprovalMode.MANUAL\n                    session_state.approval_mode_key = None\n                    if adapter._on_approval_mode_fallback is not None:\n                        adapter._on_approval_mode_fallback(ApprovalMode.MANUAL.value)\n                    adapter._update_status(\"Approval mode fell back to Manual\")\n                    msg = (\n                        \"Manual approval mode could not be persisted; graph execution \"\n                        \"is blocked until the Store is available.\"\n                    )\n                    raise RuntimeError(msg) from exc\n                selected_mode = ApprovalMode.MANUAL\n                session_state.approval_mode = ApprovalMode.MANUAL\n                context[\"approval_mode\"] = ApprovalMode.MANUAL.value\n                context[\"auto_approve\"] = False\n                if adapter._on_approval_mode_fallback is not None:\n                    adapter._on_approval_mode_fallback(ApprovalMode.MANUAL.value)\n                adapter._update_status(\"Approval mode fell back to Manual\")\n            context[\"approval_mode_key\"] = live_key\n            session_state.approval_mode_key = live_key\n\n            from deepagents_code.hooks.interrupt import is_hook_interrupt_payload\n            from deepagents_code.hooks.models.domain import HookEvent\n\n            hooks.apply_graph_context(context)\n\n            # Show the Thinking spinner before each astream iteration so\n            # both the first turn and HITL/ask_user resumes surface feedback\n            # while the model processes input. Skip when","sourceCodeStart":1921,"sourceCodeEnd":1957,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/tui/textual_adapter.py#L1921-L1957","documentation":"When persisting the approval mode fails, the adapter falls back to MANUAL (in-memory) and notifies the UI, but because graph execution cannot safely continue without durable approval state, it re-raises the original failure as RuntimeError with this message. This prevents executing with an approval mode that could silently differ from what the user selected.","triggerScenarios":"During execute_task_textual, writing the selected approval mode to the Store raises (Store unavailable, connection error, backend exception); the fallback to MANUAL succeeds in memory but persistence still fails, so the turn is blocked.","commonSituations":"Remote agent Store outage mid-session; network partition to the persistence backend; expired credentials for the Store; running a session whose Store writer was never initialized.","solutions":["Restore Store connectivity (check network/credentials/backend health) and retry the turn.","Restart the session so the Store writer is re-established before continuing.","If persistence is repeatedly unavailable, run without auto-approve (Manual mode) via a config that does not require Store persistence.","Wrap the persistence call to surface a retry dialog instead of killing graph execution."],"exampleFix":"// before\npersist_approval_mode(adapter, mode)  # raises on Store outage\n// after\ntry:\n    persist_approval_mode(adapter, mode)\nexcept StoreUnavailable:\n    adapter._update_status(\"Store offline; staying in Manual approval mode\")\n    mode = ApprovalMode.MANUAL","handlingStrategy":"try-catch","validationCode":"if not store_health_check(adapter):\n    adapter._update_status(\"Store offline; forcing Manual approval mode\")\n    session_state.approval_mode = ApprovalMode.MANUAL\nelse:\n    persist_approval_mode(adapter, selected_mode)","typeGuard":null,"tryCatchPattern":"try:\n    persist_approval_mode(adapter, selected_mode)\nexcept RuntimeError as exc:\n    logger.error(\"approval persistence failed, staying Manual: %s\", exc)\n    selected_mode = ApprovalMode.MANUAL","preventionTips":["Health-check the Store before each turn in remote sessions.","Retry Store writes with backoff before failing the turn.","Alert on Store outages so approval persistence degradation is visible."],"tags":["persistence","approval-mode","store"],"backgroundTag":"store-persist-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}