affaan-m/ECC · error · Error

No Codex rollout sessions found

Error message

No Codex rollout sessions found

What it means

resolveRolloutPath was called with target 'latest' (or codex:latest) but findLatestRollout(sessionsDir) returned null. The Codex worktree adapter found no rollout files in the resolved Codex sessions directory.

Source

Thrown at scripts/lib/session-adapters/codex-worktree.js:110

  return files
    .map(filePath => ({ filePath, mtimeMs: fs.statSync(filePath).mtimeMs }))
    .sort((a, b) => b.mtimeMs - a.mtimeMs)[0].filePath;
}

function findRolloutById(sessionsDir, sessionId) {
  return listRolloutFiles(sessionsDir)
    .find(filePath => path.basename(filePath).includes(sessionId)) || null;
}

function resolveRolloutPath(target, cwd, options, context) {
  const explicitTarget = parseCodexTarget(target);
  const sessionsDir = resolveSessionsDir(options, context);

  if (explicitTarget) {
    if (explicitTarget === 'latest') {
      const latest = findLatestRollout(sessionsDir);
      if (!latest) {
        throw new Error('No Codex rollout sessions found');
      }

      return { rolloutPath: latest, sourceTarget: { type: 'codex-worktree', value: 'latest' } };
    }

    const absoluteExplicit = path.resolve(cwd, explicitTarget);
    if (fs.existsSync(absoluteExplicit) && isRolloutFile(absoluteExplicit)) {
      return { rolloutPath: absoluteExplicit, sourceTarget: { type: 'codex-rollout-file', value: absoluteExplicit } };
    }

    const byId = findRolloutById(sessionsDir, explicitTarget);
    if (byId) {
      return { rolloutPath: byId, sourceTarget: { type: 'codex-worktree', value: explicitTarget } };
    }

    throw new Error(`Codex rollout session not found: ${explicitTarget}`);
  }

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Run Codex at least once so it creates a rollout file, then retry 'latest'.
  2. Verify the sessions directory resolveSessionsDir points at exists and contains *.rollout* (or listRolloutFiles-matching) files.
  3. If CODEX_HOME or the worktree root is overridden, set it to the directory that actually holds the rollouts.
  4. Pass an explicit rollout id or absolute path instead of 'latest'.

Example fix

// before
adapter.open('codex:latest', { cwd });

// after
adapter.open('codex:<known-session-id>', { cwd });
// or run `codex` once to seed the sessions directory, then retry 'latest'
Defensive patterns

Strategy: validation

Validate before calling

const latest = findLatestRollout(sessionsDir);
if (!latest) {
  throw new Error(`No Codex rollouts in ${sessionsDir}; run 'codex' first or pass an explicit rollout id.`);
}

Type guard

function hasAnyCodexRollout(sessionsDir) {
  return listRolloutFiles(sessionsDir).length > 0;
}

Try / catch

try { return resolveRolloutPath('latest', cwd, options, context); }
catch (err) {
  if (err.message === 'No Codex rollout sessions found') {
    throw new Error('No Codex rollouts found. Pass an explicit rollout id or .rollout path.');
  }
  throw err;
}

Prevention

When it happens

Trigger: Requesting the latest Codex rollout on a machine where Codex has never run, or where the sessions directory is set to an empty/non-existent path. CODEX_HOME or the worktree root is overridden so resolveSessionsDir points elsewhere.

Common situations: Fresh environment with no Codex rollouts. CI container with isolated HOME lacking ~/.codex. Worktree root passed via context does not contain a sessions subdir. Codex CLI version writes rollouts to a different path.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/1c809af25ee191cb. Report an issue: GitHub.