BigPizzaV3/CodexPlusPlus · error
session index cleanup preview task failed
Error message
session index cleanup preview task failed: {error} What it means
preview_session_index_cleanup dispatches codex_plus_data::preview_session_index_cleanup to a blocking thread with tauri::async_runtime::spawn_blocking and awaits it. A JoinError on .await (blocking task panicked or cancelled) is mapped into this error before the inner Result is checked with and_then.
Solutions
- Inspect the wrapped JoinError text — a panic report points at the exact scan/parse line to fix
- Harden preview_session_index_cleanup to return Err on malformed index entries instead of panicking
- Back up or repair the corrupted session index file the preview reads
- Retry if cancellation during app shutdown caused the join failure
Defensive patterns
Strategy: try-catch
Try / catch
match tauri::async_runtime::spawn_blocking(|| codex_plus_data::preview_session_index_cleanup(None)).await {
Ok(Ok(preview)) => { /* 展示预览 */ }
Ok(Err(data_err)) => eprintln!("preview failed: {data_err}"),
Err(join_err) => eprintln!("preview task panicked or was cancelled: {join_err}"),
} Prevention
- Harden the preview scan to skip or report malformed session index entries instead of panicking
- Repair or back up corrupted session index files before running cleanup previews
- Keep blocking closures returning Result for all IO and parse failures
- Don't run previews during app shutdown when cancellation is likely
When it happens
Trigger: The spawn_blocking closure running codex_plus_data::preview_session_index_cleanup(None) panicked or its JoinHandle resolved to Err(JoinError) — e.g. a panic while scanning/parsing session index files, or runtime cancellation.
Common situations: Corrupt or malformed session index entries causing unwrap/index panics in the preview scan, locked or unreadable session files hit by a panic path, or app shutdown cancelling the blocking task.
Related errors
- session index cleanup task failed
- provider target discovery task failed
- archived lookup task failed
- 微信连接运行锁已损坏
- export markdown task failed
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/a4321503fcb46f13.
Report an issue: GitHub.
Appendix: source
Thrown at apps/codex-plus-manager/src-tauri/src/commands.rs:3235
unavailable_reason,
});
}
}
targets.targets.sort_by(|left, right| {
right
.is_current_provider
.cmp(&left.is_current_provider)
.then_with(|| left.id.cmp(&right.id))
});
}
#[tauri::command]
pub async fn preview_session_index_cleanup() -> CommandResult<Value> {
let result = tauri::async_runtime::spawn_blocking(|| {
codex_plus_data::preview_session_index_cleanup(None)
})
.await
.map_err(|error| anyhow::anyhow!("session index cleanup preview task failed: {error}"))
.and_then(|result| result);
match result {
Ok(preview) => ok(
&format!(
"发现 {} 条仅存在于任务索引中的候选记录。",
preview.candidates.len()
),
json!({
"snapshotSha256": preview.snapshot_sha256,
"candidates": preview.candidates,
}),
),
Err(error) => failed(&format!("预览失效任务索引失败:{error}"), json!({})),
}
}
#[tauri::command]
pub async fn apply_session_index_cleanup(View on GitHub (pinned to b1ed92e5e4)