affaan-m/ECC · error · Error

No session adapter matched target: ${target}

Error message

No session adapter matched target: ${target}

What it means

Thrown by registry.select() after it normalized the target and found no adapter whose canOpen() returned true, with no adapterId resolvable from target/context. This is the fallback resolution path: the registry asks every adapter 'can you open this?' and all decline.

Source

Thrown at scripts/lib/session-adapters/registry.js:125

        throw new Error(`Unknown session adapter: ${id}`);
      }

      return adapter;
    },
    listAdapters() {
      return adapters.map(adapter => ({
        id: adapter.id,
        description: adapter.description || '',
        targetTypes: Array.isArray(adapter.targetTypes) ? [...adapter.targetTypes] : []
      }));
    },
    select(target, context = {}) {
      const normalized = normalizeStructuredTarget(target, context);
      const adapter = normalized.context.adapterId
        ? this.getAdapter(normalized.context.adapterId)
        : adapters.find(candidate => candidate.canOpen(normalized.target, normalized.context));
      if (!adapter) {
        throw new Error(`No session adapter matched target: ${target}`);
      }

      return adapter;
    },
    open(target, context = {}) {
      const normalized = normalizeStructuredTarget(target, context);
      const adapter = this.select(normalized.target, normalized.context);
      return adapter.open(normalized.target, normalized.context);
    }
  };
}

function inspectSessionTarget(target, options = {}) {
  const registry = createAdapterRegistry(options);
  return registry.open(target, options).getSnapshot();
}

module.exports = {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Match the target format to an adapter: 'claude:<alias>', 'codex:<worktree>', 'opencode:<id>', or a tmux plan/session name.
  2. Use a structured target with an explicit `type` (and let TARGET_TYPE_TO_ADAPTER_ID map it) or set `adapterId` directly.
  3. Ensure the chosen adapter's runtime deps are present (tmux binary, git worktrees, opencode state dir).
  4. Call registry.listAdapters() to confirm which adapters are registered and can compete for the target.

Example fix

// before
registry.open('/some/random/path.json');
// throws: No session adapter matched target: /some/random/path.json

// after
registry.open({ type: 'claude-alias', value: 'my-alias' });
Defensive patterns

Strategy: validation

Validate before calling

function selectOrThrow(registry, target, context = {}) {
  const match = registry.listAdapters()
    .find(a => a.canOpen(typeof target === 'object' ? target.value : target, context));
  if (!match) {
    throw new Error(`no adapter can open ${JSON.stringify(target)}; registered: ${registry.listAdapters().map(a => a.id).join(', ')}`);
  }
  return registry.open(target, context);
}

Type guard

function canAnyAdapterOpen(registry, target, context = {}) {
  return registry.listAdapters().some(a => {
    try { return a.canOpen(target, context); } catch { return false; }
  });
}

Try / catch

try {
  registry.open(target);
} catch (err) {
  if (/No session adapter matched/.test(err.message)) {
    // provide explicit type/adapterId or fix the scheme prefix
  } else throw err;
}

Prevention

When it happens

Trigger: Passing a plain string target whose scheme/path no adapter recognizes (e.g. an arbitrary file path with no claude:/codex:/opencode: prefix and not a tmux plan/session); a target whose adapter runtime dependency is missing so canOpen() returns false (tmux not installed, git worktree absent); a structured target with a type not in TARGET_TYPE_TO_ADAPTER_ID and no adapterId.

Common situations: Unsupported target format; target points at a session/path that does not exist on the machine; adapter prerequisites (tmux, git worktrees, opencode state) not installed; passing a raw path when a scheme-prefixed string is expected.

Related errors


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