{"record":{"id":"de56ebf1cb0d0d85","repo":"Fission-AI/OpenSpec","slug":"specname-added-failed-for-header-requireme","errorCode":null,"errorMessage":"${specName} ADDED failed for header \"### Requirement: ${add.name}\" - already exists","messagePattern":"(.+?) ADDED failed for header \"### Requirement: (.+?)\" - already exists","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":491,"sourceCode":"    if (normalizeBlockRaw(currentBlock.raw) !== normalizeBlockRaw(mod.raw)) {\n      modifiedApplied++;\n    }\n    nameToBlock.set(key, mod);\n  }\n\n  // ADDED\n  let addedApplied = 0;\n  for (const add of plan.added) {\n    const key = normalizeRequirementName(add.name);\n    const existing = nameToBlock.get(key);\n    if (existing) {\n      // Identical content means the requirement was already synced to the\n      // baseline (early-sync pattern) — re-applying it is a no-op, not a\n      // conflict. Only differing content is a genuine collision.\n      if (normalizeBlockRaw(existing.raw) === normalizeBlockRaw(add.raw)) {\n        continue;\n      }\n      throw new Error(`${specName} ADDED failed for header \"### Requirement: ${add.name}\" - already exists`);\n    }\n    nameToBlock.set(key, add);\n    addedApplied++;\n  }\n\n  // Duplicates within resulting map are implicitly prevented by key uniqueness.\n\n  // Recompose requirements section preserving original ordering where possible\n  const keptOrder: RequirementBlock[] = [];\n  const seen = new Set<string>();\n  for (const block of parts.bodyBlocks) {\n    const key = normalizeRequirementName(block.name);\n    const replacement = nameToBlock.get(key);\n    if (replacement) {\n      keptOrder.push(replacement);\n      seen.add(key);\n    }\n    // A block's raw runs to the next header the parser RECOGNISES, so a note","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L473-L509","documentation":"Error \"${specName} ADDED failed for header \"### Requirement: ${add.name}\" - already exists\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/specs-apply.ts:491 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}