Hmbown/CodeWhale · error · anyhow::Error
Failed to persist fork: {persistence_error}; cleanup also fa
Error message
Failed to persist fork: {persistence_error}; cleanup also failed: {} What it means
fork cleanup path: the forked thread was built in memory but persisting it to the store failed, and rolling back the already-saved turns/items also failed (both errors are reported). The system is left possibly partially persisted, so the message carries both the persistence error and the cleanup error for diagnosis rather than hiding one.
Source
Thrown at crates/tui/src/runtime_threads.rs:5161
if let Err(persistence_error) = persistence {
let mut cleanup_errors = Vec::new();
if let Err(error) = self.store.remove_thread(&thread.id) {
cleanup_errors.push(format!("remove thread: {error}"));
}
for turn_id in saved_turn_ids.iter().rev() {
if let Err(error) = self.store.remove_turn(turn_id) {
cleanup_errors.push(format!("remove turn {turn_id}: {error}"));
}
}
for item_id in saved_item_ids.iter().rev() {
if let Err(error) = self.store.remove_item(item_id) {
cleanup_errors.push(format!("remove item {item_id}: {error}"));
}
}
if cleanup_errors.is_empty() {
return Err(persistence_error);
}
bail!(
"Failed to persist fork: {persistence_error}; cleanup also failed: {}",
cleanup_errors.join("; ")
);
}
Ok(())
}
/// Seed a thread with messages from a saved session so subsequent turns
/// continue with the prior conversation context.
///
/// Unlike the old text-only implementation, this preserves all content
/// block types (thinking, tool_use, tool_result, etc.) as separate turn
/// items so that `loadHistory` in the GUI can reconstruct the full
/// conversation including process information.
pub async fn seed_thread_from_messages(
&self,
thread_id: &str,
messages: &[Message],View on GitHub (pinned to 0c42157ee5)
Solutions
- Check both embedded errors (store persistence and cleanup)
- Inspect the thread store for partially-saved fork artifacts
- Free disk/lock contention and retry the fork
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/tui/src/runtime_threads.rs:5161 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/d78e43c4cc293190.
Report an issue: GitHub.