nikivdev/code · error
failed to resume codex session {}
Error message
failed to resume codex session {} What it means
After computing a resume plan, the tool attempts to resume the existing codex session via the resume bridge. If the bridge reports that no session was actually resumed/launched, it bails with the failing session ID. It signals the stored session could not be attached to.
Source
Thrown at src/ai.rs:11749
.session_id
.as_deref()
.ok_or_else(|| anyhow::anyhow!("missing session id for resume plan"))?;
println!(
"Opening Codex session {} in {}...",
truncate_recover_id(session_id),
launch_path.display()
);
if launch_session_for_target(
session_id,
Provider::Codex,
plan.prompt.as_deref(),
Some(&launch_path),
plan.runtime_state_path.as_deref(),
plan.trace.as_ref(),
)? {
Ok(())
} else {
bail!("failed to resume codex session {}", session_id);
}
}
"new" | "recover-new" => {
maybe_open_cursor_for_pr_feedback_check(plan);
new_session_for_target(
Provider::Codex,
plan.prompt.as_deref(),
Some(&launch_path),
plan.runtime_state_path.as_deref(),
plan.trace.as_ref(),
)
}
other => bail!("unsupported codex open action: {}", other),
}
}
fn maybe_open_cursor_for_pr_feedback_check(plan: &CodexOpenPlan) {
let Some(query) = planView on GitHub (pinned to a747e741ae)
Solutions
- Verify the session ID exists in the codex session/runtime state listing
- Start a fresh session (`new` action) if the old rollout is gone
- Check codex CLI version compatibility and re-login/repair the runtime
Defensive patterns
Strategy: try-catch
Validate before calling
// confirm the session/runtime state exists before resuming
let states = codex_runtime::load_runtime_states()?;
if !states.iter().any(|s| s.session_id == session_id) {
eprintln!("{} has no runtime state; use new session", session_id);
} Type guard
fn resumable(states: &[RuntimeState], id: &str) -> bool {
states.iter().any(|s| s.session_id == id)
} Try / catch
match result {
Err(e) if e.to_string().starts_with("failed to resume codex session") => new_session_for_target(Provider::Codex, ...),
other => other,
} Prevention
- Don't prune ~/.codex session/rollout files while sessions are active
- Keep codex CLI version consistent between machines
- Treat resume failure as a signal to start a new session
When it happens
Trigger: `f codex open <session>` with action resume/recover where `run_codex_resume...` returns false — e.g. the runtime state or rollout file for that session ID is missing, corrupted, or the underlying process could not be launched.
Common situations: Resuming a session from an old machine after upgrading codex (rollout format/path changed); deleted `~/.codex/sessions` history; passing an ID copied from logs that was never persisted.
Related errors
- fzf not found on PATH – install it to use fuzzy selection.
- Session file not found for Codex session {}
- connect is only supported for Codex sessions; use `f codex c
- runtime helpers are only supported for Codex sessions; use `
- doctor is only supported for Codex sessions; use `f codex do
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/3645c145e095041b.
Report an issue: GitHub.