BigPizzaV3/CodexPlusPlus · error
thread usage history task failed
Error message
thread usage history task failed: {error} What it means
This error wraps a JoinError from tokio::task::spawn_blocking in `thread_usage_history` (apps/codex-plus-launcher/src/main.rs:690). The blocking task running adapter.codex_thread_usage_history never completed normally — it panicked or was cancelled by the runtime. Database/query errors from the adapter are returned through the inner Result, not this message.
Solutions
- Inspect the JoinError for a panic payload pointing at codex_thread_usage_history
- Replace panicking unwraps in the adapter with proper error returns
- Keep the future alive until it resolves; don't abort on UI navigation
- At shutdown, wait for pending blocking tasks before dropping the runtime
Defensive patterns
Strategy: try-catch
Type guard
fn join_error_is_panic(err: &tokio::task::JoinError) -> bool { err.is_panic() } Try / catch
Err(tokio::task::JoinError) with is_panic() => log into_panic() payload; otherwise treat as cancellation and optionally retry once
Prevention
- Don't cancel usage-history queries when UI navigates away
- Make codex_thread_usage_history panic-free on corrupt records
- Drain blocking tasks at shutdown
When it happens
Trigger: Calling `thread_usage_history(session)` when the blocking closure panics (e.g. unwrap on malformed usage JSON), when the future is cancelled, or during runtime shutdown.
Common situations: Querying usage history for a session with corrupted usage records; aborting the request when the UI navigates away; process teardown mid-query.
Related errors
- archived lookup task failed
- export markdown task failed
- Remote Control candidate check failed
- session export task failed
- session import task failed
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/2ef1af4eea945f12.
Report an issue: GitHub.
Appendix: source
Thrown at apps/codex-plus-launcher/src/main.rs:690
tokio::task::spawn_blocking(move || adapter.undo(&undo_token))
.await
.map_err(|error| anyhow::anyhow!("undo task failed: {error}"))
}
async fn export_markdown(&self, session: SessionRef) -> anyhow::Result<ExportResult> {
let db_paths = self.candidate_db_paths();
tokio::task::spawn_blocking(move || {
codex_plus_data::export_markdown_from_paths(db_paths, &session)
})
.await
.map_err(|error| anyhow::anyhow!("export markdown task failed: {error}"))
}
async fn thread_usage_history(&self, session: SessionRef) -> anyhow::Result<Value> {
let adapter = self.storage_adapter();
tokio::task::spawn_blocking(move || adapter.codex_thread_usage_history(&session))
.await
.map_err(|error| anyhow::anyhow!("thread usage history task failed: {error}"))
}
async fn find_archived_thread_by_title(
&self,
title: String,
) -> anyhow::Result<Option<SessionRef>> {
let adapter = self.storage_adapter();
tokio::task::spawn_blocking(move || adapter.find_archived_thread_by_title(&title))
.await
.map_err(|error| anyhow::anyhow!("archived lookup task failed: {error}"))
}
async fn recover_remote_control_session(&self, thread_id: String) -> anyhow::Result<Value> {
let settings = codex_plus_core::settings::SettingsStore::default()
.load()
.unwrap_or_default();
let profile = settings.active_relay_profile();
if !settings.relay_profiles_enabledView on GitHub (pinned to b1ed92e5e4)