affaan-m/ECC · error · Error
No Claude session history found
Error message
No Claude session history found
What it means
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.
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 01e15490f0)
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.
Example fix
// before
adapter.open('latest', { cwd });
// after: pass an explicit id, or ensure history exists
adapter.open('<known-session-id>', { cwd });
// or run `claude` once to seed ~/.claude/projects/<project>/ with a session file Defensive patterns
Strategy: validation
Validate before calling
const { sessions } = sessionManager.getAllSessions({ limit: 1 });
if (sessions.length === 0) {
throw new Error('No Claude sessions available; run `claude` first or pass an explicit session path.');
} Type guard
function hasAnyClaudeSession() {
return sessionManager.getAllSessions({ limit: 1 }).sessions.length > 0;
} Try / catch
try { return resolveSessionRecord('latest', cwd); }
catch (err) {
if (err.message === 'No Claude session history found') {
// prompt user for an explicit path instead of 'latest'
throw new Error('No Claude history found. Pass an explicit session id or .tmp path.');
}
throw err;
} Prevention
- 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'.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported session file: ${sessionPath}
- Claude session not found: ${explicitTarget}
- Unsupported Claude session target: ${target}
- No Codex rollout sessions found
- No OpenCode sessions found
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/13998a658869e9c1.
Report an issue: GitHub.