{"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":"validation","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/session-adapters/claude-history.js#L46-L82","documentation":"resolveSessionRecord in the Claude history adapter throws this when the session target resolves to 'latest' but sessionManager.getAllSessions({limit:1}) returns no sessions. It means the Claude session store (~/.claude/projects history files) is empty or unreadable, so there is no 'most recent' session to resolve.","triggerScenarios":"Calling resolveSessionRecord (directly or via the adapter factory in createClaudeHistoryAdapter) with parseClaudeTarget(target) === 'latest' while getAllSessions({limit:1}).sessions is an empty array — e.g. no Claude sessions exist on disk for the current project or the sessions directory is misconfigured.","commonSituations":"Fresh machine or CI container where Claude has never been used in this project; CLAUDE_CONFIG_DIR pointed at an empty/wrong directory; project path changed so session filenames no longer match the current cwd; history files pruned by a cleanup script.","solutions":["Run Claude Code once in this project to generate at least one session, then retry.","Verify the sessions directory (CLAUDE_CONFIG_DIR / history path) that sessionManager reads actually contains session files.","Pass an explicit session id/filename or a session file path as target instead of 'latest'.","Check cwd: session lookup is scoped to the project; run from the correct repository root.","List available sessions via sessionManager.getAllSessions() and pick a valid one."],"exampleFix":"// before\nconst { session } = adapter.resolveSessionRecord('latest'); // throws when history empty\n// after\nconst sessions = sessionManager.getAllSessions({ limit: 1 }).sessions;\nif (sessions.length === 0) throw new Error('Run `claude` in this project first; no session history exists.');\nconst { session } = adapter.resolveSessionRecord('latest');","handlingStrategy":"fallback","validationCode":"const latest = sessionManager.getAllSessions({ limit: 1 }).sessions;\nif (!latest || latest.length === 0) throw new Error('No Claude session history; run claude in this project first');","typeGuard":"function hasLatest(sessions) { return Array.isArray(sessions) && sessions.length > 0; }","tryCatchPattern":"try { return adapter.resolveSessionRecord('latest'); } catch (e) { if (e.message === 'No Claude session history found') return null; throw e; }","preventionTips":["Check for existing sessions before requesting 'latest'","Pin CLAUDE_CONFIG_DIR in CI so history is never empty unexpectedly","Prefer explicit session ids in automation","Verify cwd matches the project with history"],"tags":["session","claude","history","not-found"],"backgroundTag":"empty-result-set","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"}