affaan-m/ECC · error · Error
Unsupported Codex session target
Error message
Unsupported Codex session target: ${target} What it means
Terminal guard of resolveRolloutPath: the target did not parse as 'latest', a rollout id, or a Codex rollout file path, so the adapter cannot resolve it. It is the Codex analogue of the unsupported-target error.
Solutions
- Supply 'latest', a valid rollout id from the sessions dir, or an existing rollout .jsonl file path.
- Confirm the file extension/format matches what isCodexRolloutFileTarget accepts.
- Trim the value and log it to catch empty or misquoted input.
- Route the call to the correct adapter (claude-history / opencode) if the target belongs to another harness.
- Check cwd resolution: relative paths are resolved against cwd.
Example fix
// before
resolve('./sessions'); // directory, not a rollout file -> throws
// after
const t = target.trim();
if (t !== 'latest' && !(fs.existsSync(t) && fs.statSync(t).isFile() && t.endsWith('.jsonl'))) {
throw new Error(`Unsupported Codex target '${t}': use 'latest', a rollout id, or a .jsonl rollout path`);
}
resolve(t); Defensive patterns
Strategy: validation
Validate before calling
if (target !== 'latest' && !(typeof target === 'string' && fs.existsSync(target) && fs.statSync(target).isFile() && target.endsWith('.jsonl'))) throw new Error(`Invalid Codex target: '${target}'`); Type guard
function isValidCodexTarget(t) { return t === 'latest' || (typeof t === 'string' && t.endsWith('.jsonl') && fs.existsSync(t) && fs.statSync(t).isFile()); } Try / catch
try { return adapter.resolveRolloutPath(target); } catch (e) { if (/^Unsupported Codex session target:/.test(e.message)) console.error(`Codex target must be 'latest', a rollout id, or a .jsonl path; got '${target}'`); throw e; } Prevention
- Validate target shape before dispatching to the adapter
- Never pass directories as targets
- Match target type to the correct harness adapter
- Trim values coming from env/config
When it happens
Trigger: resolveRolloutPath called with strings like '', a directory path, a Claude/OpenCode session path, or any value isCodexRolloutFileTarget(target, cwd) rejects after explicitTarget is null and no id lookup was possible.
Common situations: Passing an OpenCode or Claude session file to the Codex adapter; empty env/config value; path pointing at a directory rather than a rollout file; wrong extension (isCodexRolloutFileTarget likely requires .jsonl).
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Codex rollout session not found
- No Codex rollout sessions found
- Unsupported Claude session target
- Unsupported OpenCode session target
- Cannot delete active session
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/8bc6bce26a0852ec.
Report an issue: GitHub.
Appendix: 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 8321021c54)