affaan-m/ECC · error · Error
No Claude session history found
Error message
No Claude session history found
What it means
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.
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.
Example fix
// before
const { session } = adapter.resolveSessionRecord('latest'); // throws when history empty
// after
const sessions = sessionManager.getAllSessions({ limit: 1 }).sessions;
if (sessions.length === 0) throw new Error('Run `claude` in this project first; no session history exists.');
const { session } = adapter.resolveSessionRecord('latest'); Defensive patterns
Strategy: fallback
Validate before calling
const latest = sessionManager.getAllSessions({ limit: 1 }).sessions;
if (!latest || latest.length === 0) throw new Error('No Claude session history; run claude in this project first'); Type guard
function hasLatest(sessions) { return Array.isArray(sessions) && sessions.length > 0; } Try / catch
try { return adapter.resolveSessionRecord('latest'); } catch (e) { if (e.message === 'No Claude session history found') return null; throw e; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Claude session not found
- Codex rollout session not found
- No Codex rollout sessions found
- No OpenCode sessions found
- OpenCode session not found
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/13998a658869e9c1.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/session-adapters/claude-history.js:64
...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) {
const explicitTarget = parseClaudeTarget(target);
if (explicitTarget) {
if (explicitTarget === 'latest') {
const [latest] = sessionManager.getAllSessions({ limit: 1 }).sessions;
if (!latest) {
throw new Error('No Claude session history found');
}
return {
session: sessionManager.getSessionById(latest.filename, true),
sourceTarget: {
type: 'claude-history',
value: 'latest'
}
};
}
const alias = sessionAliases.resolveAlias(explicitTarget);
if (alias) {
return {
session: hydrateSessionFromPath(alias.sessionPath),
sourceTarget: {
type: 'claude-alias',
value: explicitTargetView on GitHub (pinned to 8321021c54)