{"record":{"id":"f4f0d5e92711d58f","repo":"Hmbown/CodeWhale","slug":"failed-to-persist-compaction-persistence-error-f4f0d5","errorCode":null,"errorMessage":"Failed to persist compaction: {persistence_error}; cleanup also failed: {cleanup_error}","messagePattern":"Failed to persist compaction: (.+?); cleanup also failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":6455,"sourceCode":"                compaction_id: Some(compaction_id),\n            });\n            state.route_identity = route_identity;\n            state.route_model = route_model;\n\n            let persistence_result = (|| -> Result<()> {\n                self.store.save_turn(&turn)?;\n                current_thread.latest_turn_id = Some(turn_id.clone());\n                current_thread.updated_at = now;\n                self.store.save_thread(&current_thread)\n            })();\n            if let Err(persistence_error) = persistence_result {\n                let cleanup_error = self.cleanup_unaccepted_turn_records(&turn_id, None).err();\n                state.active_turn = None;\n                state.route_identity = previous_active_route.0;\n                state.route_model = previous_active_route.1;\n                return match cleanup_error {\n                    None => Err(anyhow!(\"Failed to persist compaction: {persistence_error}\")),\n                    Some(cleanup_error) => Err(anyhow!(\n                        \"Failed to persist compaction: {persistence_error}; cleanup also failed: {cleanup_error}\"\n                    )),\n                };\n            }\n\n            self.register_runtime_usage_sink(&turn_id);\n            let policy = RuntimePolicyProjection::from_persisted(\n                &current_thread.mode,\n                current_thread.permission_posture.as_deref(),\n                current_thread.auto_approve,\n            );\n            engine.publish_turn_authority(\n                policy.mode,\n                current_thread.allow_shell,\n                current_thread.trust_mode,\n                policy.auto_approve(),\n                policy.permission,\n                configured_sandbox_mode,","sourceCodeStart":6437,"sourceCodeEnd":6473,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/runtime_threads.rs#L6437-L6473","documentation":"Compound sentinel in trigger_compaction: the primary save_turn/save_thread persistence failed (persistence_error), and the follow-up cleanup_unaccepted_turn_records rollback also failed (cleanup_error). Both error strings are embedded; the store may retain a partially persisted compaction turn that the engine never acknowledged.","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:6455 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Resolve the store-level persistence error (permissions, disk space, lock contention)","Manually inspect the thread's turn list for the orphaned compaction turn id and remove it","Ensure no concurrent compaction or shutdown is racing this trigger"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}