{"record":{"id":"13998a658869e9c1","repo":"affaan-m/ECC","slug":"no-claude-session-history-found","errorCode":null,"errorMessage":"No Claude session history found","messagePattern":"No Claude session history found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/session-adapters/claude-history.js","lineNumber":64,"sourceCode":"    ...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) {\n  const explicitTarget = parseClaudeTarget(target);\n\n  if (explicitTarget) {\n    if (explicitTarget === 'latest') {\n      const [latest] = sessionManager.getAllSessions({ limit: 1 }).sessions;\n      if (!latest) {\n        throw new Error('No Claude session history found');\n      }\n\n      return {\n        session: sessionManager.getSessionById(latest.filename, true),\n        sourceTarget: {\n          type: 'claude-history',\n          value: 'latest'\n        }\n      };\n    }\n\n    const alias = sessionAliases.resolveAlias(explicitTarget);\n    if (alias) {\n      return {\n        session: hydrateSessionFromPath(alias.sessionPath),\n        sourceTarget: {\n          type: 'claude-alias',\n          value: explicitTarget","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/session-adapters/claude-history.js#L46-L82","documentation":"resolveSessionRecord was called with target 'latest' (or claude:latest) but sessionManager.getAllSessions({limit:1}) returned an empty sessions list. The Claude history adapter cannot find any session file in the configured Claude history directory.","triggerScenarios":"Calling the adapter with target 'latest' on a machine where Claude Code has never written a session, or where the history directory is set to an empty/non-existent path. The Claude config dir was wiped or points elsewhere via CLAUDE_CONFIG_DIR / HOME.","commonSituations":"Fresh environment with no Claude sessions yet. CI runner with an isolated HOME that has no ~/.claude history. Claude config dir overridden to a custom location that has no projects/*/sessions. Permission errors reading the history dir cause getAllSessions to silently return empty.","solutions":["Run Claude Code once locally so it creates at least one session, then retry 'latest'.","Verify the history directory sessionManager scans exists and is non-empty (typically ~/.claude/projects/<project>/<uuid>.tmp).","If HOME or CLAUDE_CONFIG_DIR is overridden, point it at the directory that actually holds the Claude sessions.","Instead of 'latest', pass an explicit session id or absolute path to a known session file."],"exampleFix":"// before\nadapter.open('latest', { cwd });\n\n// after: pass an explicit id, or ensure history exists\nadapter.open('<known-session-id>', { cwd });\n// or run `claude` once to seed ~/.claude/projects/<project>/ with a session file","handlingStrategy":"validation","validationCode":"const { sessions } = sessionManager.getAllSessions({ limit: 1 });\nif (sessions.length === 0) {\n  throw new Error('No Claude sessions available; run `claude` first or pass an explicit session path.');\n}","typeGuard":"function hasAnyClaudeSession() {\n  return sessionManager.getAllSessions({ limit: 1 }).sessions.length > 0;\n}","tryCatchPattern":"try { return resolveSessionRecord('latest', cwd); }\ncatch (err) {\n  if (err.message === 'No Claude session history found') {\n    // prompt user for an explicit path instead of 'latest'\n    throw new Error('No Claude history found. Pass an explicit session id or .tmp path.');\n  }\n  throw err;\n}","preventionTips":["Seed the history by running Claude once before scripting against 'latest'.","Verify HOME / CLAUDE_CONFIG_DIR point at the dir containing the sessions.","In automation, prefer explicit ids over 'latest'."],"tags":["claude-history","session-resolution","empty-state"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}