{"record":{"id":"8bc6bce26a0852ec","repo":"affaan-m/ECC","slug":"unsupported-codex-session-target-target","errorCode":null,"errorMessage":"Unsupported Codex session target: ${target}","messagePattern":"Unsupported Codex session target: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/session-adapters/codex-worktree.js","lineNumber":134,"sourceCode":"    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;\n    }\n\n    try {\n      records.push(JSON.parse(trimmed));\n    } catch {\n      // Rollout logs are append-only; skip partial/corrupt trailing lines.\n    }\n  }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/session-adapters/codex-worktree.js#L116-L152","documentation":"resolveRolloutPath exhausted all branches: the target is not 'latest', not an explicit id with a matching file, and isCodexRolloutFileTarget(target,cwd) returned false (file does not exist, is not a file, or isRolloutFile rejected it). The Codex adapter cannot interpret the target string.","triggerScenarios":"Passing a target that is neither a Codex id nor a path to an existing rollout file (e.g. a project name, directory, or non-rollout file). The referenced file does not exist. The file extension/content does not satisfy isRolloutFile.","commonSituations":"User passes a bare project name. Relative path resolved against the wrong cwd. File is present but not recognized as a rollout by isRolloutFile (wrong extension or magic header).","solutions":["Use one of the supported forms: 'latest', a Codex session id, or an absolute/relative path to an existing rollout file.","Confirm the path exists and isRolloutFile accepts it (check extension and that it parses as JSON lines).","Pass the correct cwd for relative paths.","For structured targets, pass { type: 'codex-worktree'|'codex', value: <id-or-path> }."],"exampleFix":"// before\nadapter.open('codex:my-project', { cwd }); // unsupported\n\n// after\nadapter.open('codex:latest', { cwd });\n// or\nadapter.open('/abs/path/to/rollout.jsonl', { cwd });\n// or structured\nadapter.open({ type: 'codex-worktree', value: '/abs/path/to/rollout.jsonl' }, { cwd });","handlingStrategy":"validation","validationCode":"function assertCodexTargetShape(target, cwd) {\n  if (target === 'latest') return;\n  const abs = path.resolve(cwd, target);\n  const isFile = fs.existsSync(abs) && fs.statSync(abs).isFile() && isRolloutFile(abs);\n  const byId = findRolloutById(resolveSessionsDir({}, {}), target);\n  if (!isFile && !byId) {\n    throw new Error(`Unsupported Codex target: ${target}. Use 'latest', a rollout id, or a .rollout path.`);\n  }\n}","typeGuard":"function isCodexTargetPlausible(target, cwd) {\n  if (target === 'latest') return true;\n  if (typeof target !== 'string') return false;\n  const abs = path.resolve(cwd, target);\n  return fs.existsSync(abs) && fs.statSync(abs).isFile() && isRolloutFile(abs);\n}","tryCatchPattern":"try { return resolveRolloutPath(target, cwd, options, context); }\ncatch (err) {\n  if (err.message.startsWith('Unsupported Codex session target:')) {\n    throw new Error(`${err.message}. Supported: 'latest' | rollout id | path to a rollout file.`);\n  }\n  throw err;\n}","preventionTips":["Pass an absolute rollout path when unsure.","Use structured targets {type:'codex-worktree', value:path} for clarity.","Confirm isRolloutFile accepts the file (extension + JSON-lines parse)."],"tags":["codex-worktree","session-resolution","unsupported-target"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}