{"record":{"id":"22c7bfa47f99d69d","repo":"affaan-m/ECC","slug":"no-session-adapter-matched-target-target","errorCode":null,"errorMessage":"No session adapter matched target: ${target}","messagePattern":"No session adapter matched target: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/lib/session-adapters/registry.js","lineNumber":125,"sourceCode":"        throw new Error(`Unknown session adapter: ${id}`);\n      }\n\n      return adapter;\n    },\n    listAdapters() {\n      return adapters.map(adapter => ({\n        id: adapter.id,\n        description: adapter.description || '',\n        targetTypes: Array.isArray(adapter.targetTypes) ? [...adapter.targetTypes] : []\n      }));\n    },\n    select(target, context = {}) {\n      const normalized = normalizeStructuredTarget(target, context);\n      const adapter = normalized.context.adapterId\n        ? this.getAdapter(normalized.context.adapterId)\n        : adapters.find(candidate => candidate.canOpen(normalized.target, normalized.context));\n      if (!adapter) {\n        throw new Error(`No session adapter matched target: ${target}`);\n      }\n\n      return adapter;\n    },\n    open(target, context = {}) {\n      const normalized = normalizeStructuredTarget(target, context);\n      const adapter = this.select(normalized.target, normalized.context);\n      return adapter.open(normalized.target, normalized.context);\n    }\n  };\n}\n\nfunction inspectSessionTarget(target, options = {}) {\n  const registry = createAdapterRegistry(options);\n  return registry.open(target, options).getSnapshot();\n}\n\nmodule.exports = {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/lib/session-adapters/registry.js#L107-L143","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Match the target format to an adapter: 'claude:<alias>', 'codex:<worktree>', 'opencode:<id>', or a tmux plan/session name.","Use a structured target with an explicit `type` (and let TARGET_TYPE_TO_ADAPTER_ID map it) or set `adapterId` directly.","Ensure the chosen adapter's runtime deps are present (tmux binary, git worktrees, opencode state dir).","Call registry.listAdapters() to confirm which adapters are registered and can compete for the target."],"exampleFix":"// before\nregistry.open('/some/random/path.json');\n// throws: No session adapter matched target: /some/random/path.json\n\n// after\nregistry.open({ type: 'claude-alias', value: 'my-alias' });","handlingStrategy":"validation","validationCode":"function selectOrThrow(registry, target, context = {}) {\n  const match = registry.listAdapters()\n    .find(a => a.canOpen(typeof target === 'object' ? target.value : target, context));\n  if (!match) {\n    throw new Error(`no adapter can open ${JSON.stringify(target)}; registered: ${registry.listAdapters().map(a => a.id).join(', ')}`);\n  }\n  return registry.open(target, context);\n}","typeGuard":"function canAnyAdapterOpen(registry, target, context = {}) {\n  return registry.listAdapters().some(a => {\n    try { return a.canOpen(target, context); } catch { return false; }\n  });\n}","tryCatchPattern":"try {\n  registry.open(target);\n} catch (err) {\n  if (/No session adapter matched/.test(err.message)) {\n    // provide explicit type/adapterId or fix the scheme prefix\n  } else throw err;\n}","preventionTips":["Use scheme-prefixed string targets (claude:, codex:, opencode:) so canOpen can match deterministically.","Confirm adapter runtime deps (tmux, git worktrees) are installed before relying on canOpen.","Set adapterId explicitly when you know which adapter you want."],"tags":["session-adapters","target-resolution","fallback"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}