{"record":{"id":"d0070f3ec0f9c601","repo":"affaan-m/ECC","slug":"unsupported-claude-session-target-target","errorCode":null,"errorMessage":"Unsupported Claude session target: ${target}","messagePattern":"Unsupported Claude session target: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/session-adapters/claude-history.js","lineNumber":111,"sourceCode":"      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      }\n    };\n  }\n\n  throw new Error(`Unsupported Claude session target: ${target}`);\n}\n\nfunction createClaudeHistoryAdapter(options = {}) {\n  const persistCanonicalSnapshotImpl = options.persistCanonicalSnapshotImpl || persistCanonicalSnapshot;\n\n  return {\n    id: 'claude-history',\n    description: 'Claude local session history and session-file snapshots',\n    targetTypes: ['claude-history', 'claude-alias', 'session-file'],\n    canOpen(target, context = {}) {\n      if (context.adapterId && context.adapterId !== 'claude-history') {\n        return false;\n      }\n\n      if (context.adapterId === 'claude-history') {\n        return true;\n      }\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/session-adapters/claude-history.js#L93-L129","documentation":"The terminal guard of resolveSessionRecord: the target string did not parse as 'latest', a known session id, or a session file path, so the adapter cannot interpret it. parseClaudeTarget returned null and isSessionFileTarget-style path resolution did not accept it either.","triggerScenarios":"Calling resolveSessionRecord with arbitrary strings such as '', 'foo', a directory path, a URL, or a target for a different adapter (e.g. a Codex rollout path passed to the Claude adapter).","commonSituations":"Mixing up adapter targets (Codex 'rollout' vs Claude 'latest'); passing a raw directory instead of a session file; shell quoting dropping an argument so target becomes empty; config key wired to the wrong adapter.","solutions":["Use one of the supported forms: 'latest', a valid session id from getAllSessions(), or a path to an existing session file.","Check that the value is not empty or whitespace — trim or fail fast upstream.","Verify the right adapter is being invoked (claude-history vs codex-worktree vs opencode).","Inspect parseClaudeTarget to confirm the accepted formats and match yours.","If it comes from config/CLI, log the exact value received to catch quoting/interpolation bugs."],"exampleFix":"// before\nresolve('some-unknown-token');\n// after\nif (target !== 'latest' && !fs.existsSync(target)) {\n  throw new Error(`Target '${target}' must be 'latest', a session id, or an existing session file path`);\n}\nresolve(target);","handlingStrategy":"validation","validationCode":"if (typeof target !== 'string' || !target.trim()) throw new Error('Claude target must be a non-empty string');\nif (target !== 'latest' && !fs.existsSync(target)) throw new Error(`Claude target '${target}' is not 'latest' or an existing file`);","typeGuard":"function isValidClaudeTarget(t) { return t === 'latest' || (typeof t === 'string' && t.trim().length > 0); }","tryCatchPattern":"try { return adapter.resolveSessionRecord(target); } catch (e) { if (/^Unsupported Claude session target:/.test(e.message)) { console.error(`Supported: 'latest', session id, or session file path; got '${target}'`); } throw e; }","preventionTips":["Whitelist the three accepted target forms at your call site","Log the raw target to catch shell quoting/env interpolation bugs","Route targets to the matching adapter per harness","Trim user/env input before passing"],"tags":["session","claude","invalid-argument"],"backgroundTag":"invalid-argument-value","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"}