affaan-m/ECC · error · Error
Claude session not found: ${explicitTarget}
Error message
Claude session not found: ${explicitTarget} What it means
resolveSessionRecord received an explicit target that is not 'latest', did not resolve to a registered alias, and sessionManager.getSessionById(explicitTarget, true) returned null. The Claude history adapter could not find a session with that id in the configured history directory.
Source
Thrown at scripts/lib/session-adapters/claude-history.js:89
value: 'latest'
}
};
}
const alias = sessionAliases.resolveAlias(explicitTarget);
if (alias) {
return {
session: hydrateSessionFromPath(alias.sessionPath),
sourceTarget: {
type: 'claude-alias',
value: explicitTarget
}
};
}
const session = sessionManager.getSessionById(explicitTarget, true);
if (!session) {
throw new Error(`Claude session not found: ${explicitTarget}`);
}
return {
session,
sourceTarget: {
type: 'claude-history',
value: explicitTarget
}
};
}
if (isSessionFileTarget(target, cwd)) {
return {
session: hydrateSessionFromPath(path.resolve(cwd, target)),
sourceTarget: {
type: 'session-file',
value: path.resolve(cwd, target)
}View on GitHub (pinned to 01e15490f0)
Solutions
- List available sessions to confirm the id: sessionManager.getAllSessions({}).sessions.map(s => s.filename).
- If the session exists on another machine, sync the .tmp file into the local history dir before resolving.
- Register the path as an alias via sessionAliases if you want to reference it by a stable name.
- Pass the absolute path to the .tmp file as the target instead of the bare id (falls through to the session-file target branch).
Example fix
// before
adapter.open('abc123', { cwd }); // not found
// after
const { sessions } = sessionManager.getAllSessions({});
adapter.open(sessions[0].filename, { cwd });
// or
adapter.open('/abs/path/to/session.tmp', { cwd }); Defensive patterns
Strategy: validation
Validate before calling
const session = sessionManager.getSessionById(explicitTarget, true);
if (!session && !sessionAliases.resolveAlias(explicitTarget)) {
const available = sessionManager.getAllSessions({}).sessions.map(s => s.filename).join(', ');
throw new Error(`Claude session not found: ${explicitTarget}. Available: ${available}`);
} Type guard
function claudeTargetExists(target) {
return target === 'latest'
|| Boolean(sessionAliases.resolveAlias(target))
|| Boolean(sessionManager.getSessionById(target, true));
} Try / catch
try { return resolveSessionRecord(target, cwd); }
catch (err) {
if (err.message.startsWith('Claude session not found:')) {
// list candidates and rethrow with suggestions
const list = sessionManager.getAllSessions({}).sessions.map(s => s.filename);
throw new Error(`${err.message}. Known sessions: ${list.join(', ')}`);
}
throw err;
} Prevention
- List sessions before resolving a bare id.
- Sync rollout files into the local history dir when running cross-machine.
- Use aliases for stable references.
When it happens
Trigger: Passing a session id that was never recorded, was deleted, or lives in a different Claude history directory. Typing or truncating a UUID. Pointing CLAUDE_CONFIG_DIR at the wrong location so getSessionById cannot see the file.
Common situations: Copy-paste error in a session id. Session was pruned by Claude's retention/cleanup. Running against a different machine/container than where the session was created. Claude CLI version stores sessions under a different project subdirectory.
Related errors
- Unsupported session file: ${sessionPath}
- No Claude session history found
- Unsupported Claude session target: ${target}
- Codex rollout session not found: ${explicitTarget}
- OpenCode session not found: ${explicitTarget}
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/8766db73d1e02a27.
Report an issue: GitHub.