{"record":{"id":"3d1478ed02dfaa67","repo":"affaan-m/ECC","slug":"unsupported-session-file-sessionpath","errorCode":null,"errorMessage":"Unsupported session file: ${sessionPath}","messagePattern":"Unsupported session file: (.+?)","errorType":"exception","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/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/session-adapters/claude-history.js#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the file is an actual Claude session file with the original filename (usually a UUID-like prefix per Claude's convention).","If you renamed the file, restore the original basename or register it via an alias that points at the original path.","Open the file in sessionManager directly with getSessionContent if you only need contents, bypassing parseSessionFilename.","Update sessionManager.parseSessionFilename if a new Claude CLI version introduced a new filename scheme."],"exampleFix":"// before: renamed file breaks parser\nresolveSessionRecord('./my-backup.tmp', cwd);\n\n// after: keep original filename or pass the canonical session id\nresolveSessionRecord('<original-claude-session-id>.tmp', cwd);\n// or\nresolveSessionRecord('latest', cwd);","handlingStrategy":"validation","validationCode":"const parsed = sessionManager.parseSessionFilename(path.basename(sessionPath));\nif (!parsed) {\n  throw new Error(`Refusing to hydrate ${sessionPath}: not a recognized Claude session filename`);\n}","typeGuard":"function isParsableSessionFile(sessionPath) {\n  return Boolean(sessionManager.parseSessionFilename(path.basename(sessionPath)));\n}","tryCatchPattern":"try { hydrateSessionFromPath(sessionPath); }\ncatch (err) {\n  if (err.message.startsWith('Unsupported session file:')) {\n    // fall back to reading contents directly, or restore the original filename\n    return sessionManager.getSessionContent(sessionPath);\n  }\n  throw err;\n}","preventionTips":["Keep Claude session files under their original filenames.","If you must rename, register an alias pointing at the original path instead.","Confirm parseSessionFilename accepts a file before resolving it."],"tags":["claude-history","session-resolution","filename"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}