{"record":{"id":"8766db73d1e02a27","repo":"affaan-m/ECC","slug":"claude-session-not-found-explicittarget","errorCode":null,"errorMessage":"Claude session not found: ${explicitTarget}","messagePattern":"Claude session not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/session-adapters/claude-history.js","lineNumber":89,"sourceCode":"          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\n        }\n      };\n    }\n\n    const session = sessionManager.getSessionById(explicitTarget, true);\n    if (!session) {\n      throw new Error(`Claude session not found: ${explicitTarget}`);\n    }\n\n    return {\n      session,\n      sourceTarget: {\n        type: 'claude-history',\n        value: explicitTarget\n      }\n    };\n  }\n\n  if (isSessionFileTarget(target, cwd)) {\n    return {\n      session: hydrateSessionFromPath(path.resolve(cwd, target)),\n      sourceTarget: {\n        type: 'session-file',\n        value: path.resolve(cwd, target)\n      }","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/session-adapters/claude-history.js#L71-L107","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\nadapter.open('abc123', { cwd }); // not found\n\n// after\nconst { sessions } = sessionManager.getAllSessions({});\nadapter.open(sessions[0].filename, { cwd });\n// or\nadapter.open('/abs/path/to/session.tmp', { cwd });","handlingStrategy":"validation","validationCode":"const session = sessionManager.getSessionById(explicitTarget, true);\nif (!session && !sessionAliases.resolveAlias(explicitTarget)) {\n  const available = sessionManager.getAllSessions({}).sessions.map(s => s.filename).join(', ');\n  throw new Error(`Claude session not found: ${explicitTarget}. Available: ${available}`);\n}","typeGuard":"function claudeTargetExists(target) {\n  return target === 'latest'\n    || Boolean(sessionAliases.resolveAlias(target))\n    || Boolean(sessionManager.getSessionById(target, true));\n}","tryCatchPattern":"try { return resolveSessionRecord(target, cwd); }\ncatch (err) {\n  if (err.message.startsWith('Claude session not found:')) {\n    // list candidates and rethrow with suggestions\n    const list = sessionManager.getAllSessions({}).sessions.map(s => s.filename);\n    throw new Error(`${err.message}. Known sessions: ${list.join(', ')}`);\n  }\n  throw err;\n}","preventionTips":["List sessions before resolving a bare id.","Sync rollout files into the local history dir when running cross-machine.","Use aliases for stable references."],"tags":["claude-history","session-resolution","not-found"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}