affaan-m/ECC · error · Error

Unsupported session file: ${sessionPath}

Error message

Unsupported session file: ${sessionPath}

What it means

In hydrateSessionFromPath(), sessionManager.parseSessionFilename(filename) returned null, meaning the file's name does not look like a Claude session file. hydrateSessionFromPath is reached when a target resolves to a concrete .tmp session file path (via the session-file target type or an alias), so the basename must match the parser's expected pattern.

Source

Thrown at scripts/lib/session-adapters/claude-history.js:39

  return null;
}

function isSessionFileTarget(target, cwd) {
  if (typeof target !== 'string' || target.length === 0) {
    return false;
  }

  const absoluteTarget = path.resolve(cwd, target);
  return fs.existsSync(absoluteTarget)
    && fs.statSync(absoluteTarget).isFile()
    && absoluteTarget.endsWith('.tmp');
}

function hydrateSessionFromPath(sessionPath) {
  const filename = path.basename(sessionPath);
  const parsed = sessionManager.parseSessionFilename(filename);
  if (!parsed) {
    throw new Error(`Unsupported session file: ${sessionPath}`);
  }

  const content = sessionManager.getSessionContent(sessionPath);
  const stats = fs.statSync(sessionPath);

  return {
    ...parsed,
    sessionPath,
    content,
    metadata: sessionManager.parseSessionMetadata(content),
    stats: sessionManager.getSessionStats(content || ''),
    size: stats.size,
    modifiedTime: stats.mtime,
    createdTime: stats.birthtime || stats.ctime
  };
}

function resolveSessionRecord(target, cwd) {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Confirm the file is an actual Claude session file with the original filename (usually a UUID-like prefix per Claude's convention).
  2. If you renamed the file, restore the original basename or register it via an alias that points at the original path.
  3. Open the file in sessionManager directly with getSessionContent if you only need contents, bypassing parseSessionFilename.
  4. Update sessionManager.parseSessionFilename if a new Claude CLI version introduced a new filename scheme.

Example fix

// before: renamed file breaks parser
resolveSessionRecord('./my-backup.tmp', cwd);

// after: keep original filename or pass the canonical session id
resolveSessionRecord('<original-claude-session-id>.tmp', cwd);
// or
resolveSessionRecord('latest', cwd);
Defensive patterns

Strategy: validation

Validate before calling

const parsed = sessionManager.parseSessionFilename(path.basename(sessionPath));
if (!parsed) {
  throw new Error(`Refusing to hydrate ${sessionPath}: not a recognized Claude session filename`);
}

Type guard

function isParsableSessionFile(sessionPath) {
  return Boolean(sessionManager.parseSessionFilename(path.basename(sessionPath)));
}

Try / catch

try { hydrateSessionFromPath(sessionPath); }
catch (err) {
  if (err.message.startsWith('Unsupported session file:')) {
    // fall back to reading contents directly, or restore the original filename
    return sessionManager.getSessionContent(sessionPath);
  }
  throw err;
}

Prevention

When it happens

Trigger: Passing a path whose file exists and ends in .tmp but whose full basename is not a valid Claude session filename (e.g. a renamed or partial file). Pointing an alias at an arbitrary .tmp file. isSessionFileTarget accepted the file (exists, isFile, endsWith('.tmp')) but parseSessionFilename rejected the naming scheme.

Common situations: User copies a Claude session file to a custom name like my-session.tmp before resolving. A .tmp scratch file from another tool happens to live in the directory. Claude CLI version changed its session filename format and sessionManager.parseSessionFilename has not been updated.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/3d1478ed02dfaa67. Report an issue: GitHub.