{"record":{"id":"5f235d214d5cd6a6","repo":"affaan-m/ECC","slug":"harness-capability-catalog-is-out-of-sync-with-ins","errorCode":null,"errorMessage":"Harness capability catalog is out of sync with install targets","messagePattern":"Harness capability catalog is out of sync with install targets","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/harness-capabilities.js","lineNumber":288,"sourceCode":"}\n\nfunction validateCatalog() {\n  const adapters = listInstallTargetAdapters();\n  const adapterByTarget = new Map(adapters.map(adapter => [adapter.target, adapter]));\n  const catalogTargetIds = HARNESS_CAPABILITIES.flatMap(harness => harness.targetIds);\n\n  if (new Set(catalogTargetIds).size !== catalogTargetIds.length) {\n    throw new Error('Harness capability catalog contains duplicate install target ids');\n  }\n\n  const supported = [...SUPPORTED_INSTALL_TARGETS].sort();\n  const registered = adapters.map(adapter => adapter.target).sort();\n  const catalogued = [...catalogTargetIds].sort();\n  if (\n    JSON.stringify(catalogued) !== JSON.stringify(supported)\n    || JSON.stringify(catalogued) !== JSON.stringify(registered)\n  ) {\n    throw new Error('Harness capability catalog is out of sync with install targets');\n  }\n\n  for (const harness of HARNESS_CAPABILITIES) {\n    for (const declaredScope of harness.scopes) {\n      const adapter = adapterByTarget.get(declaredScope.targetId);\n      if (!adapter || expectedRootForAdapter(adapter) !== declaredScope.root) {\n        throw new Error(\n          `Harness capability root is out of sync for target ${declaredScope.targetId}`\n        );\n      }\n    }\n  }\n}\n\nvalidateCatalog();\n\nfunction listHarnessCapabilities() {\n  return HARNESS_CAPABILITIES.slice();","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/harness-capabilities.js#L270-L306","documentation":"validateCatalog throws this when the set of target ids catalogued in HARNESS_CAPABILITIES does not exactly equal both the SUPPORTED_INSTALL_TARGETS list and the ids registered by the install-target adapters (compared as sorted JSON). It is a three-way sync check between catalog, supported list, and adapters.","triggerScenarios":"Adding/removing an install target adapter without updating HARNESS_CAPABILITIES; updating SUPPORTED_INSTALL_TARGETS but forgetting one of the other two lists; a merge where one side added a target to the catalog and the other to the adapters.","commonSituations":"Contributors wiring a new harness surface: they edit one file (e.g. add an adapter) but not the capability catalog; stale catalog after a target rename; CI sync test fails before any user-facing runtime impact.","solutions":["Update all three surfaces together: the adapter, SUPPORTED_INSTALL_TARGETS, and HARNESS_CAPABILITIES targetIds.","Regenerate derived artifacts (`npm run catalog:sync`) and commit the diff.","Run the catalog validation tests to see exactly which ids are missing or extra.","If removing a target, delete it from all three lists and remove any adapterByTarget references."],"exampleFix":"// before: adapter added, catalog not updated\nSUPPORTED_INSTALL_TARGETS.add('windsurf-rules');\n// HARNESS_CAPABILITIES lacks 'windsurf-rules'\n\n// after\nSUPPORTED_INSTALL_TARGETS.add('windsurf-rules');\nHARNESS_CAPABILITIES.push({ id: 'windsurf', targetIds: ['windsurf-rules'], scopes: [{ targetId: 'windsurf-rules', root: '.windsurf' }] });","handlingStrategy":"validation","validationCode":"const catalogued = HARNESS_CAPABILITIES.flatMap(h => h.targetIds).sort();\nconst supported = [...SUPPORTED_INSTALL_TARGETS].sort();\nconst registered = listInstallTargetAdapters().map(a => a.target).sort();\nif (JSON.stringify(catalogued) !== JSON.stringify(supported) || JSON.stringify(catalogued) !== JSON.stringify(registered)) {\n  throw new Error('Catalog, supported targets, and adapters are out of sync');\n}","typeGuard":null,"tryCatchPattern":"try {\n  validateCatalog();\n} catch (e) {\n  if (/out of sync with install targets/.test(e.message)) {\n    console.error('Update adapter list, SUPPORTED_INSTALL_TARGETS, and HARNESS_CAPABILITIES together.');\n  }\n  throw e;\n}","preventionTips":["Treat adapter, supported-targets, and catalog edits as one atomic change.","Run `npm run catalog:sync` after adding or removing any install target.","Add a unit test asserting the three lists are equal so CI catches drift."],"tags":["config","sync","catalog","invariant"],"backgroundTag":"internal-invariant-violation","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"}