affaan-m/ECC · error · Error

Unsupported Claude session target

Error message

Unsupported Claude session target: ${target}

What it means

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.

Solutions

  1. Use one of the supported forms: 'latest', a valid session id from getAllSessions(), or a path to an existing session file.
  2. Check that the value is not empty or whitespace — trim or fail fast upstream.
  3. Verify the right adapter is being invoked (claude-history vs codex-worktree vs opencode).
  4. Inspect parseClaudeTarget to confirm the accepted formats and match yours.
  5. If it comes from config/CLI, log the exact value received to catch quoting/interpolation bugs.

Example fix

// before
resolve('some-unknown-token');
// after
if (target !== 'latest' && !fs.existsSync(target)) {
  throw new Error(`Target '${target}' must be 'latest', a session id, or an existing session file path`);
}
resolve(target);
Defensive patterns

Strategy: validation

Validate before calling

if (typeof target !== 'string' || !target.trim()) throw new Error('Claude target must be a non-empty string');
if (target !== 'latest' && !fs.existsSync(target)) throw new Error(`Claude target '${target}' is not 'latest' or an existing file`);

Type guard

function isValidClaudeTarget(t) { return t === 'latest' || (typeof t === 'string' && t.trim().length > 0); }

Try / catch

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; }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/d0070f3ec0f9c601. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/session-adapters/claude-history.js:111

      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)
      }
    };
  }

  throw new Error(`Unsupported Claude session target: ${target}`);
}

function createClaudeHistoryAdapter(options = {}) {
  const persistCanonicalSnapshotImpl = options.persistCanonicalSnapshotImpl || persistCanonicalSnapshot;

  return {
    id: 'claude-history',
    description: 'Claude local session history and session-file snapshots',
    targetTypes: ['claude-history', 'claude-alias', 'session-file'],
    canOpen(target, context = {}) {
      if (context.adapterId && context.adapterId !== 'claude-history') {
        return false;
      }

      if (context.adapterId === 'claude-history') {
        return true;
      }

View on GitHub (pinned to 8321021c54)