affaan-m/ECC · error · Error

Unsupported Claude session target: ${target}

Error message

Unsupported Claude session target: ${target}

What it means

resolveSessionRecord exhausted every resolution branch: the target is not 'latest', not a known alias, not a session id found by getSessionById, and isSessionFileTarget(target,cwd) returned false (file does not exist, is not a file, or does not end in .tmp). The Claude history adapter cannot interpret the target string.

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 01e15490f0)

Solutions

  1. Use one of the supported forms: 'latest', a session id, a registered alias, or an absolute/relative path to an existing .tmp session file.
  2. Verify the path exists and ends with '.tmp': fs.existsSync(p) && fs.statSync(p).isFile() && p.endsWith('.tmp').
  3. If resolving from cwd, pass the correct cwd so the relative path resolves.
  4. For structured targets, pass { type: 'claude-history'|'claude-alias'|'session-file', value: <path-or-id> } instead of an ambiguous string.

Example fix

// before
adapter.open('my-project', { cwd }); // unsupported

// after
adapter.open('latest', { cwd });
// or
adapter.open('/abs/path/to/session.tmp', { cwd });
// or structured
adapter.open({ type: 'session-file', value: '/abs/path/to/session.tmp' }, { cwd });
Defensive patterns

Strategy: validation

Validate before calling

function assertClaudeTargetShape(target, cwd) {
  if (target === 'latest') return;
  if (sessionAliases.resolveAlias(target)) return;
  if (sessionManager.getSessionById(target, true)) return;
  const abs = path.resolve(cwd, target);
  if (!fs.existsSync(abs) || !fs.statSync(abs).isFile() || !abs.endsWith('.tmp')) {
    throw new Error(`Unsupported Claude target: ${target}. Use 'latest', an id, an alias, or a .tmp file path.`);
  }
}

Type guard

function isClaudeTargetPlausible(target, cwd) {
  if (target === 'latest') return true;
  if (typeof target !== 'string') return false;
  const abs = path.resolve(cwd, target);
  return fs.existsSync(abs) && fs.statSync(abs).isFile() && abs.endsWith('.tmp');
}

Try / catch

try { return resolveSessionRecord(target, cwd); }
catch (err) {
  if (err.message.startsWith('Unsupported Claude session target:')) {
    throw new Error(`${err.message}. Supported: 'latest' | session id | alias | path to a .tmp file.`);
  }
  throw err;
}

Prevention

When it happens

Trigger: Passing a target like a bare project name, a directory path, a non-.tmp file, or a typo. Passing a target with an unsupported prefix (e.g. 'foo:bar'). The referenced file does not exist on disk.

Common situations: User assumes the adapter accepts a project name or URL. Path is relative and resolved against the wrong cwd so the file is not found. The file extension is not .tmp so isSessionFileTarget rejects it.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/d0070f3ec0f9c601. Report an issue: GitHub.