BigPizzaV3/CodexPlusPlus · error
session import task failed
Error message
session import task failed: {error} What it means
This error wraps a JoinError from tokio::task::spawn_blocking in `import_session_file` (apps/codex-plus-launcher/src/main.rs:818). The blocking call to codex_plus_core::session_share::import_rollout never returned normally — it panicked or was cancelled. Payload-validation errors are returned through the inner Result and the `?`, so this message indicates the join/cancellation layer.
Solutions
- Inspect JoinError::into_panic to find the panicking unwrap in import_rollout
- Harden import_rollout to validate the payload and return Err instead of panicking
- Validate the payload JSON shape before invoking the import
- Await the future to completion; drain tasks at shutdown
Example fix
// before
.map_err(|error| anyhow::anyhow!("session import task failed: {error}"))?
// after
.map_err(|error| anyhow::anyhow!("session import task panicked/cancelled: {error}"))? Defensive patterns
Strategy: validation
Validate before calling
// validate payload shape before importing
let obj = payload.as_object().ok_or_else(|| anyhow::anyhow!("payload must be an object"))?;
obj.get("session_id").and_then(|v| v.as_str()).ok_or_else(|| anyhow::anyhow!("missing session_id"))?; Type guard
fn is_valid_import_payload(v: &serde_json::Value) -> bool {
v.get("session_id").and_then(|s| s.as_str()).map_or(false, |s| !s.is_empty())
} Try / catch
if !is_valid_import_payload(&payload) { bail!("invalid import payload"); }
match spawn_blocking(move || import_rollout(&home, &payload)).await {
Ok(Ok(v)) => v,
Ok(Err(e)) => eprintln!("import error: {e}"),
Err(je) => eprintln!("import task panicked/cancelled: {je}"),
} Prevention
- Validate the session-file schema before importing
- Check version compatibility of imported session files
- Make import_rollout panic-free on malformed payloads
- Await imports to completion
When it happens
Trigger: Calling `import_session_file(payload)` when import_rollout panics on a malformed session payload (unwraps during JSON/rollout parsing), when the future is dropped, or during runtime shutdown.
Common situations: Importing a session file produced by a different/older version with an unexpected schema; importing during app quit; aborted import on UI cancel.
Related errors
- archived lookup task failed
- export markdown task failed
- Remote Control candidate check failed
- session export task failed
- thread usage history task failed
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/0440d3c3fb6b338a.
Report an issue: GitHub.
Appendix: source
Thrown at apps/codex-plus-launcher/src/main.rs:818
.with_codex_home(codex_plus_core::codex_sqlite::default_codex_home_dir())
}
async fn export_session_file(&self, session: SessionRef) -> anyhow::Result<Value> {
let home = codex_plus_core::codex_sqlite::default_codex_home_dir();
tokio::task::spawn_blocking(move || {
codex_plus_core::session_share::export_rollout(&home, &session.session_id)
})
.await
.map_err(|error| anyhow::anyhow!("session export task failed: {error}"))?
}
async fn import_session_file(&self, payload: Value) -> anyhow::Result<Value> {
let home = codex_plus_core::codex_sqlite::default_codex_home_dir();
tokio::task::spawn_blocking(move || {
codex_plus_core::session_share::import_rollout(&home, &payload)
})
.await
.map_err(|error| anyhow::anyhow!("session import task failed: {error}"))?
}
}
struct LauncherRuntimeService {
debug_port: Mutex<u16>,
websocket_url: Mutex<Option<String>>,
user_scripts: UserScriptManager,
}
impl LauncherRuntimeService {
fn new(debug_port: u16, user_scripts: UserScriptManager) -> Self {
Self {
debug_port: Mutex::new(debug_port),
websocket_url: Mutex::new(None),
user_scripts,
}
}
View on GitHub (pinned to b1ed92e5e4)