{"record":{"id":"1449ddceb39878b6","repo":"Fission-AI/OpenSpec","slug":"specname-validation-failed-duplicate-requirem-1449dd","errorCode":null,"errorMessage":"${specName} validation failed - duplicate requirement in MODIFIED for header \"### Requirement: ${mod.name}\"","messagePattern":"(.+?) validation failed - duplicate requirement in MODIFIED for header \"### Requirement: (.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":212,"sourceCode":"  const plan = parseDeltaSpec(changeContent);\n  const specName = update.id;\n\n  // Pre-validate duplicates within sections\n  const addedNames = new Set<string>();\n  for (const add of plan.added) {\n    const name = normalizeRequirementName(add.name);\n    if (addedNames.has(name)) {\n      throw new Error(\n        `${specName} validation failed - duplicate requirement in ADDED for header \"### Requirement: ${add.name}\"`\n      );\n    }\n    addedNames.add(name);\n  }\n  const modifiedNames = new Set<string>();\n  for (const mod of plan.modified) {\n    const name = normalizeRequirementName(mod.name);\n    if (modifiedNames.has(name)) {\n      throw new Error(\n        `${specName} validation failed - duplicate requirement in MODIFIED for header \"### Requirement: ${mod.name}\"`\n      );\n    }\n    modifiedNames.add(name);\n  }\n  const removedNamesSet = new Set<string>();\n  for (const rem of plan.removed) {\n    const name = normalizeRequirementName(rem);\n    if (removedNamesSet.has(name)) {\n      throw new Error(\n        `${specName} validation failed - duplicate requirement in REMOVED for header \"### Requirement: ${rem}\"`\n      );\n    }\n    removedNamesSet.add(name);\n  }\n  const renamedFromSet = new Set<string>();\n  const renamedToSet = new Set<string>();\n  for (const { from, to } of plan.renamed) {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L194-L230","documentation":"Pre-validation in buildUpdatedSpec: two entries in the MODIFIED section normalize to the same requirement name. Caught via a Set of normalized names before mutation, preventing two conflicting modifications of one requirement.","triggerScenarios":"Thrown at src/core/specs-apply.ts:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Combine the two MODIFIED blocks for that requirement into one","Delete the stale duplicate entry from the change spec","Verify the headers differ by more than case or whitespace if both were intentional"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","contentChangedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}