openai/codex · error

failed to determine the working directory recorded for the…

Error message

failed to determine the working directory recorded for the selected session

What it means

Raised in resolve_cwd_for_resume_or_fork when read_session_cwd cannot recover the working directory recorded for the selected session — the state DB row is missing or the rollout file lacks cwd metadata — so the resume/fork cwd prompt has no recorded value to offer.

Solutions

  1. Choose the current working directory instead of the session's recorded cwd
  2. Pick a different session that has complete cwd metadata
  3. Repair or delete the corrupt/incomplete session record in the state DB
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at codex-rs/tui/src/session_resume.rs:130 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/b2313fff5a3045f8. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/tui/src/session_resume.rs:130

    state_db_ctx: Option<&StateRuntime>,
    target_session: &SessionTarget,
    action: CwdPromptAction,
    cwd_context: ResumeCwdContext<'_>,
) -> color_eyre::Result<ResolveCwdOutcome> {
    if matches!(cwd_context.mode, Some(ResumeCwdMode::Current)) {
        return Ok(ResolveCwdOutcome::Continue(Some(
            cwd_context.remembered_current_cwd.to_path_buf(),
        )));
    }
    let Some(history_cwd) = read_session_cwd(
        state_db_ctx,
        target_session.thread_id,
        target_session.path.as_deref(),
    )
    .await
    else {
        if matches!(cwd_context.mode, Some(ResumeCwdMode::Session)) {
            color_eyre::eyre::bail!(
                "failed to determine the working directory recorded for the selected session"
            );
        }
        return Ok(ResolveCwdOutcome::Continue(None));
    };
    match cwd_context.mode {
        Some(ResumeCwdMode::Session) => {
            return Ok(ResolveCwdOutcome::Continue(Some(history_cwd)));
        }
        Some(ResumeCwdMode::Current) | None => {}
    }
    if cwds_differ(cwd_context.current_cwd, &history_cwd) {
        let selection_outcome = cwd_prompt::run_cwd_selection_prompt(
            tui,
            config,
            action,
            cwd_context.current_cwd,
            &history_cwd,

View on GitHub (pinned to 339751715c)