BigPizzaV3/CodexPlusPlus · error
delete task failed
Error message
delete task failed: {error} What it means
The delete command runs the storage adapter's delete on tokio::task::spawn_blocking and maps a JoinError from awaiting the task into this error. It does not mean the deletion was refused — it means the blocking task never returned normally (it panicked or was cancelled).
Solutions
- Extract and log the panic payload from the JoinError (error.into_panic()/try_into_panic) to find the root cause inside adapter.delete.
- Fix the panicking path in the storage adapter (handle rusqlite errors instead of unwrapping; retry on SQLITE_BUSY).
- Ensure the delete completes before runtime shutdown, or make undo tokens consistent so a cancelled delete can be safely retried.
- Re-run the delete after the DB lock holder exits.
Example fix
// before
.await.map_err(|error| anyhow!("delete task failed: {error}"))
// after
.await.map_err(|error| match error.try_into_panic() {
Ok(panic) => anyhow!("delete task panicked: {panic:?}"),
Err(join) => anyhow!("delete task cancelled: {join}"),
})
Defensive patterns
Strategy: try-catch
Try / catch
match delete_session(id).await {
Err(e) if e.to_string().contains("delete task failed") => {
tracing::error!("delete join error: {e:#}");
/* keep undo token intact and offer retry */
}
other => other?,
} Prevention
- Handle rusqlite errors (e.g. SQLITE_BUSY) in adapter.delete instead of unwrapping.
- Avoid cancelling in-flight deletes during shutdown; await them or mark them resumable.
- Preserve the undo token across failed attempts so retries stay safe.
- Log JoinError panic payloads to expose the underlying panic.
When it happens
Trigger: The spawn_blocking closure performing the delete panics (e.g. SQLite error unwrapped inside adapter.delete, poisoned internal state), or the future is dropped/await cancelled mid-delete.
Common situations: Deleting sessions while the codex SQLite DB is locked by another process causing a panic path; app shutdown cancelling an in-flight delete; a bug in the storage adapter triggered by an unusual session payload.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- provider sync task failed
- Remote Control session recovery task failed
- undo task failed
- archived lookup task failed
- bridge context lock poisoned
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/aec93363dba92a5c.
Report an issue: GitHub.
Appendix: source
Thrown at apps/codex-plus-launcher/src/main.rs:667
}
}
}
#[async_trait::async_trait]
impl BridgeDataService for LauncherDataService {
async fn delete(&self, session: SessionRef) -> anyhow::Result<DeleteResult> {
let db_paths = self.candidate_db_paths();
let backup_store = codex_plus_data::BackupStore::new(self.backup_dir.clone());
tokio::task::spawn_blocking(move || {
codex_plus_data::delete_local_from_paths(
db_paths,
backup_store,
&session,
Some(&codex_plus_core::codex_sqlite::default_codex_home_dir()),
)
})
.await
.map_err(|error| anyhow::anyhow!("delete task failed: {error}"))
}
async fn undo(&self, undo_token: String) -> anyhow::Result<DeleteResult> {
let adapter = self.storage_adapter();
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}"))
}
View on GitHub (pinned to b1ed92e5e4)