Fission-AI/OpenSpec · error

validation failed - duplicate requirement in MODIFIED for…

Error message

${specName} validation failed - duplicate requirement in MODIFIED for header "### Requirement: ${mod.name}"

What it means

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.

Solutions

  1. Combine the two MODIFIED blocks for that requirement into one
  2. Delete the stale duplicate entry from the change spec
  3. Verify the headers differ by more than case or whitespace if both were intentional
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/specs-apply.ts:212 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/1449ddceb39878b6. Report an issue: GitHub.

Appendix: source

Thrown at src/core/specs-apply.ts:212

  const plan = parseDeltaSpec(changeContent);
  const specName = update.id;

  // Pre-validate duplicates within sections
  const addedNames = new Set<string>();
  for (const add of plan.added) {
    const name = normalizeRequirementName(add.name);
    if (addedNames.has(name)) {
      throw new Error(
        `${specName} validation failed - duplicate requirement in ADDED for header "### Requirement: ${add.name}"`
      );
    }
    addedNames.add(name);
  }
  const modifiedNames = new Set<string>();
  for (const mod of plan.modified) {
    const name = normalizeRequirementName(mod.name);
    if (modifiedNames.has(name)) {
      throw new Error(
        `${specName} validation failed - duplicate requirement in MODIFIED for header "### Requirement: ${mod.name}"`
      );
    }
    modifiedNames.add(name);
  }
  const removedNamesSet = new Set<string>();
  for (const rem of plan.removed) {
    const name = normalizeRequirementName(rem);
    if (removedNamesSet.has(name)) {
      throw new Error(
        `${specName} validation failed - duplicate requirement in REMOVED for header "### Requirement: ${rem}"`
      );
    }
    removedNamesSet.add(name);
  }
  const renamedFromSet = new Set<string>();
  const renamedToSet = new Set<string>();
  for (const { from, to } of plan.renamed) {

View on GitHub (pinned to 6926ccb18a)