{"record":{"id":"3d1478ed02dfaa67","repo":"affaan-m/ECC","slug":"unsupported-session-file-sessionpath","errorCode":null,"errorMessage":"Unsupported session file: ${sessionPath}","messagePattern":"Unsupported session file: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/session-adapters/claude-history.js","lineNumber":39,"sourceCode":"  return null;\n}\n\nfunction isSessionFileTarget(target, cwd) {\n  if (typeof target !== 'string' || target.length === 0) {\n    return false;\n  }\n\n  const absoluteTarget = path.resolve(cwd, target);\n  return fs.existsSync(absoluteTarget)\n    && fs.statSync(absoluteTarget).isFile()\n    && absoluteTarget.endsWith('.tmp');\n}\n\nfunction hydrateSessionFromPath(sessionPath) {\n  const filename = path.basename(sessionPath);\n  const parsed = sessionManager.parseSessionFilename(filename);\n  if (!parsed) {\n    throw new Error(`Unsupported session file: ${sessionPath}`);\n  }\n\n  const content = sessionManager.getSessionContent(sessionPath);\n  const stats = fs.statSync(sessionPath);\n\n  return {\n    ...parsed,\n    sessionPath,\n    content,\n    metadata: sessionManager.parseSessionMetadata(content),\n    stats: sessionManager.getSessionStats(content || ''),\n    size: stats.size,\n    modifiedTime: stats.mtime,\n    createdTime: stats.birthtime || stats.ctime\n  };\n}\n\nfunction resolveSessionRecord(target, cwd) {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/session-adapters/claude-history.js#L21-L57","documentation":"hydrateSessionFromPath in scripts/lib/session-adapters/claude-history.js throws this when the session file's basename cannot be parsed by sessionManager.parseSessionFilename. Only files whose names match the expected session naming convention (e.g. UUID-based .jsonl session files) are supported by the Claude history adapter; anything else is rejected up front before reading content.","triggerScenarios":"Calling hydrateSessionFromPath (via resolveSessionRecord) with a path whose filename is not a recognized session file — wrong extension, non-UUID name, exported/renamed files, or a directory path.","commonSituations":"Pointing the resolver at ~/.claude/projects JSONL files that were renamed or truncated; passing an agent transcript or sidechain file that uses a different naming scheme; version drift where the session filename format changed between Claude Code versions.","solutions":["Verify the filename matches the expected session naming convention (run sessionManager.parseSessionFilename on path.basename(sessionPath) to see why it fails).","Restore the original session filename if the file was renamed — session files must keep their canonical UUID-based name and extension.","Point the caller at a supported session file: list the directory and choose a file that parses.","If you need custom formats, add an adapter for them instead of forcing them through the Claude history hydrator."],"exampleFix":"// before\nhydrateSessionFromPath('/root/.claude/projects/x/renamed-session.jsonl');\n// after\nconst filename = path.basename(sessionPath);\nif (!sessionManager.parseSessionFilename(filename)) {\n  throw new Error(`Not a Claude session file: ${sessionPath}`);\n}\nhydrateSessionFromPath(sessionPath); // e.g. .../<uuid>.jsonl","handlingStrategy":"type-guard","validationCode":"const parsed = sessionManager.parseSessionFilename(path.basename(sessionPath));\nif (!parsed) throw new Error(`Not a supported session file: ${sessionPath}`);","typeGuard":"function isSupportedSessionFile(sessionPath) { return !!sessionManager.parseSessionFilename(path.basename(sessionPath)); }","tryCatchPattern":"try { const session = hydrateSessionFromPath(sessionPath); } catch (err) { if (String(err.message).startsWith('Unsupported session file:')) { console.warn('Skipping unrecognized session file:', sessionPath); return null; } throw err; }","preventionTips":["Filter directory listings with parseSessionFilename before hydrating.","Never rename Claude session files; keep the canonical UUID-based filename.","Check the expected naming convention for your Claude Code version.","Batch-resolve sessions defensively: skip files that fail the filename parse instead of aborting the run."],"tags":["file-format","session","unsupported-input"],"backgroundTag":"unsupported-operation","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}