{"record":{"id":"23ced9fa04380197","repo":"affaan-m/ECC","slug":"codex-rollout-session-not-found-explicittarget","errorCode":null,"errorMessage":"Codex rollout session not found: ${explicitTarget}","messagePattern":"Codex rollout session not found: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/session-adapters/codex-worktree.js","lineNumber":126,"sourceCode":"      const latest = findLatestRollout(sessionsDir);\n      if (!latest) {\n        throw new Error('No Codex rollout sessions found');\n      }\n\n      return { rolloutPath: latest, sourceTarget: { type: 'codex-worktree', value: 'latest' } };\n    }\n\n    const absoluteExplicit = path.resolve(cwd, explicitTarget);\n    if (fs.existsSync(absoluteExplicit) && isRolloutFile(absoluteExplicit)) {\n      return { rolloutPath: absoluteExplicit, sourceTarget: { type: 'codex-rollout-file', value: absoluteExplicit } };\n    }\n\n    const byId = findRolloutById(sessionsDir, explicitTarget);\n    if (byId) {\n      return { rolloutPath: byId, sourceTarget: { type: 'codex-worktree', value: explicitTarget } };\n    }\n\n    throw new Error(`Codex rollout session not found: ${explicitTarget}`);\n  }\n\n  if (isCodexRolloutFileTarget(target, cwd)) {\n    const absoluteTarget = path.resolve(cwd, target);\n    return { rolloutPath: absoluteTarget, sourceTarget: { type: 'codex-rollout-file', value: absoluteTarget } };\n  }\n\n  throw new Error(`Unsupported Codex session target: ${target}`);\n}\n\nfunction readJsonLines(filePath) {\n  const raw = fs.readFileSync(filePath, 'utf8');\n  const records = [];\n\n  for (const line of raw.split('\\n')) {\n    const trimmed = line.trim();\n    if (trimmed.length === 0) {\n      continue;","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/session-adapters/codex-worktree.js#L108-L144","documentation":"resolveRolloutPath throws this when an explicit Codex rollout identifier was given but findRolloutById(sessionsDir, explicitTarget) matched no rollout file, and the target is not directly a rollout file path either (it fell through to this throw after the id lookup).","triggerScenarios":"resolveRolloutPath called with explicitTarget set to a rollout id/session token that has no matching file under the sessions dir; id truncated, from another machine, or the rollout was deleted.","commonSituations":"Copying a rollout id from Codex UI/logs on a different machine; retention pruning removed the referenced rollout; id case mismatch; pointing at a non-rollout file that isCodexRolloutFileTarget rejects.","solutions":["Search the sessions directory for rollout files and copy the exact id from a filename.","Pass the full path to the rollout .jsonl file instead of an id.","Verify the sessions dir resolution (options/env) matches where Codex actually writes.","Check whitespace/case in the id; trim before calling.","Re-run Codex to regenerate a rollout if the history was deleted."],"exampleFix":"// before\nresolve('rollout-2026-09-14T10-00-00'); // id guess -> throws\n// after\nconst files = findRolloutFiles(sessionsDir);\nif (!files.some(f => f.includes(id))) {\n  throw new Error(`Rollout '${id}' not found. Available: ${files.map(f => path.basename(f)).join(', ')}`);\n}\nresolve(id);","handlingStrategy":"validation","validationCode":"const files = findRolloutFiles(sessionsDir);\nif (!files.some(f => path.basename(f).includes(rolloutId))) throw new Error(`Rollout '${rolloutId}' not found in ${sessionsDir}`);","typeGuard":"function isKnownRolloutId(id, files) { return typeof id === 'string' && id.trim().length > 0 && files.some(f => path.basename(f).includes(id)); }","tryCatchPattern":"try { return adapter.resolveRolloutPath(id); } catch (e) { if (/^Codex rollout session not found:/.test(e.message)) throw new Error(`Use an id from the sessions dir; '${id}' absent`); throw e; }","preventionTips":["Copy rollout ids from actual filenames","Trim ids and verify case","Pass the .jsonl file path when the id format is uncertain","Account for retention pruning of old rollouts"],"tags":["session","codex","rollout","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}