openai/codex-plugin-cc · error · Error

Claude session file not found

Error message

Claude session file not found: ${sourcePath}

What it means

Thrown by resolveClaudeSessionPath when fs.realpathSync fails on either the source path or the CLAUDE_PROJECTS_DIR (~/.claude/projects). realpathSync throws ENOENT when the target does not exist, so this indicates the supplied transcript file (or the projects dir itself) is missing on disk.

Solutions

  1. Verify the file exists: ls -l <source> and confirm it is readable.
  2. Find the correct transcript under ~/.claude/projects/<encoded-cwd>/*.jsonl and pass that path.
  3. Ensure ~/.claude/projects exists (run Claude once to create it) if the projects-dir realpathSync is the failure.
  4. Check for symlink breakage or permission errors on the path components.

Example fix

// before
resolveClaudeSessionPath(cwd, { source: '~/wrong-path/session.jsonl' }) // throws (ENOENT)

// after
// locate the real transcript first:
//   ls ~/.claude/projects/*/
resolveClaudeSessionPath(cwd, { source: realTranscriptPath })
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';
function assertFileExists(p) {
  try {
    const st = fs.statSync(p);
    if (!st.isFile()) throw new Error(`Not a file: ${p}`);
  } catch {
    throw new Error(`Transcript not found or unreadable: ${p}`);
  }
}
// call: assertFileExists(options.source);

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Calling resolveClaudeSessionPath with options.source set to a path that does not exist (typo, deleted file, wrong machine). Also thrown if ~/.claude/projects has never been created because Claude was never run on this machine.

Common situations: Path typo or stale absolute path from another host. The transcript was cleaned up by Claude's retention settings. A fresh machine where ~/.claude/projects does not yet exist. Symlink loop or permission denial causing realpathSync to throw.

Related errors


AI-assisted analysis of openai/codex-plugin-cc@db52e28f4d (2026-08-13). Data as JSON: /api/errors/1e710e7406a76405. Report an issue: GitHub.

Appendix: source

Thrown at plugins/codex/scripts/lib/claude-session-transfer.mjs:37

export function resolveClaudeSessionPath(cwd, options = {}) {
  const requestedPath = options.source || process.env[TRANSCRIPT_PATH_ENV];
  if (!requestedPath) {
    throw new Error("Could not identify the current Claude transcript. Retry with --source <path-to-claude-jsonl>.");
  }

  const sourcePath = resolveUserPath(cwd, requestedPath);
  if (path.extname(sourcePath) !== ".jsonl") {
    throw new Error(`Claude session source must be a JSONL file: ${sourcePath}`);
  }

  let source;
  let projects;
  try {
    source = fs.realpathSync(sourcePath);
    projects = fs.realpathSync(CLAUDE_PROJECTS_DIR);
  } catch {
    throw new Error(`Claude session file not found: ${sourcePath}`);
  }
  const relative = path.relative(projects, source);
  if (relative === "" || relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
    throw new Error(`Codex can import Claude sessions only from ${CLAUDE_PROJECTS_DIR}: ${source}`);
  }
  return source;
}

View on GitHub (pinned to db52e28f4d)