Hmbown/CodeWhale · error
Failed to persist compaction: {persistence_error}; cleanup a
Error message
Failed to persist compaction: {persistence_error}; cleanup also failed: {cleanup_error} What it means
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.
Source
Thrown at crates/tui/src/runtime_threads.rs:6455
compaction_id: Some(compaction_id),
});
state.route_identity = route_identity;
state.route_model = route_model;
let persistence_result = (|| -> Result<()> {
self.store.save_turn(&turn)?;
current_thread.latest_turn_id = Some(turn_id.clone());
current_thread.updated_at = now;
self.store.save_thread(¤t_thread)
})();
if let Err(persistence_error) = persistence_result {
let cleanup_error = self.cleanup_unaccepted_turn_records(&turn_id, None).err();
state.active_turn = None;
state.route_identity = previous_active_route.0;
state.route_model = previous_active_route.1;
return match cleanup_error {
None => Err(anyhow!("Failed to persist compaction: {persistence_error}")),
Some(cleanup_error) => Err(anyhow!(
"Failed to persist compaction: {persistence_error}; cleanup also failed: {cleanup_error}"
)),
};
}
self.register_runtime_usage_sink(&turn_id);
let policy = RuntimePolicyProjection::from_persisted(
¤t_thread.mode,
current_thread.permission_posture.as_deref(),
current_thread.auto_approve,
);
engine.publish_turn_authority(
policy.mode,
current_thread.allow_shell,
current_thread.trust_mode,
policy.auto_approve(),
policy.permission,
configured_sandbox_mode,View on GitHub (pinned to 0c42157ee5)
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
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/tui/src/runtime_threads.rs:6455 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/f4f0d5e92711d58f.
Report an issue: GitHub.