openai/codex-plugin-cc · error · Error

Could not identify the current Claude transcript. Retry with

Error message

Could not identify the current Claude transcript. Retry with --source <path-to-claude-jsonl>.

What it means

Thrown by resolveClaudeSessionPath when neither options.source nor the CODEX_COMPANION_TRANSCRIPT_PATH env var yields a path. The transfer feature needs an explicit Claude transcript location because it cannot reliably auto-detect the 'current' Claude session from context.

Source

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

import { ensureAbsolutePath } from "./fs.mjs";

export const TRANSCRIPT_PATH_ENV = "CODEX_COMPANION_TRANSCRIPT_PATH";
const CLAUDE_PROJECTS_DIR = path.join(os.homedir(), ".claude", "projects");

function resolveUserPath(cwd, value) {
  if (value === "~") {
    return os.homedir();
  }
  if (String(value).startsWith("~/")) {
    return path.join(os.homedir(), String(value).slice(2));
  }
  return ensureAbsolutePath(cwd, value);
}

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}`);

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Pass --source <path-to-claude-jsonl> to the command invoking resolveClaudeSessionPath.
  2. Export CODEX_COMPANION_TRANSCRIPT_PATH=/full/path/session.jsonl in the shell or wrapper script.
  3. Locate the transcript under ~/.claude/projects/<encoded-cwd>/*.jsonl and pass its absolute path.
  4. If automating, set options.source programmatically before calling resolveClaudeSessionPath.

Example fix

// before
resolveClaudeSessionPath(cwd, {}) // throws if env var unset

// after
resolveClaudeSessionPath(cwd, { source: '/home/user/.claude/projects/.../session.jsonl' })
// or in shell:
//   export CODEX_COMPANION_TRANSCRIPT_PATH=/home/user/.claude/projects/.../session.jsonl
Defensive patterns

Strategy: validation

Validate before calling

const TRANSCRIPT_PATH_ENV = 'CODEX_COMPANION_TRANSCRIPT_PATH';
function ensureSourceProvided(options, env = process.env) {
  const src = options?.source || env[TRANSCRIPT_PATH_ENV];
  if (!src) {
    throw new Error('Pass --source <path-to-claude-jsonl> or set ' + TRANSCRIPT_PATH_ENV);
  }
  return src;
}

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Calling resolveClaudeSessionPath(cwd, {}) with no source option while CODEX_COMPANION_TRANSCRIPT_PATH is unset in the environment. Happens when a slash-command runs the transfer without the --source flag and the companion env var was never exported.

Common situations: Running /codex transfer (or equivalent) for the first time without pointing it at a specific .jsonl transcript. A parent process scrubbed the environment. The user expected auto-detection from ~/.claude/projects but the API requires an explicit path.

Related errors


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