affaan-m/ECC · error · Error
Unsupported Codex session target: ${target}
Error message
Unsupported Codex session target: ${target} What it means
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.
Source
Thrown at scripts/lib/session-adapters/codex-worktree.js:134
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}`);
}
if (isCodexRolloutFileTarget(target, cwd)) {
const absoluteTarget = path.resolve(cwd, target);
return { rolloutPath: absoluteTarget, sourceTarget: { type: 'codex-rollout-file', value: absoluteTarget } };
}
throw new Error(`Unsupported Codex session target: ${target}`);
}
function readJsonLines(filePath) {
const raw = fs.readFileSync(filePath, 'utf8');
const records = [];
for (const line of raw.split('\n')) {
const trimmed = line.trim();
if (trimmed.length === 0) {
continue;
}
try {
records.push(JSON.parse(trimmed));
} catch {
// Rollout logs are append-only; skip partial/corrupt trailing lines.
}
}View on GitHub (pinned to 01e15490f0)
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> }.
Example fix
// before
adapter.open('codex:my-project', { cwd }); // unsupported
// after
adapter.open('codex:latest', { cwd });
// or
adapter.open('/abs/path/to/rollout.jsonl', { cwd });
// or structured
adapter.open({ type: 'codex-worktree', value: '/abs/path/to/rollout.jsonl' }, { cwd }); Defensive patterns
Strategy: validation
Validate before calling
function assertCodexTargetShape(target, cwd) {
if (target === 'latest') return;
const abs = path.resolve(cwd, target);
const isFile = fs.existsSync(abs) && fs.statSync(abs).isFile() && isRolloutFile(abs);
const byId = findRolloutById(resolveSessionsDir({}, {}), target);
if (!isFile && !byId) {
throw new Error(`Unsupported Codex target: ${target}. Use 'latest', a rollout id, or a .rollout path.`);
}
} Type guard
function isCodexTargetPlausible(target, cwd) {
if (target === 'latest') return true;
if (typeof target !== 'string') return false;
const abs = path.resolve(cwd, target);
return fs.existsSync(abs) && fs.statSync(abs).isFile() && isRolloutFile(abs);
} Try / catch
try { return resolveRolloutPath(target, cwd, options, context); }
catch (err) {
if (err.message.startsWith('Unsupported Codex session target:')) {
throw new Error(`${err.message}. Supported: 'latest' | rollout id | path to a rollout file.`);
}
throw err;
} Prevention
- 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).
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Unsupported Claude session target: ${target}
- No Codex rollout sessions found
- Codex rollout session not found: ${explicitTarget}
- Unsupported OpenCode session target: ${target}
- Unsupported session file: ${sessionPath}
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/8bc6bce26a0852ec.
Report an issue: GitHub.