{"record":{"id":"4bc53aa05eb6aa56","repo":"Fission-AI/OpenSpec","slug":"specname-validation-failed-when-a-rename-exis","errorCode":null,"errorMessage":"${specName} validation failed - when a rename exists, MODIFIED must reference the NEW header \"### Requirement: ${to}\"","messagePattern":"(.+?) validation failed - when a rename exists, MODIFIED must reference the NEW header \"### Requirement: (.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":276,"sourceCode":"    const fromNorm = normalizeRequirementName(from);\n    const toNorm = normalizeRequirementName(to);\n    // A REMOVED naming the FROM side contradicts the rename. This used to\n    // fail incidentally at apply time (the rename consumed the old header,\n    // so REMOVED hit \"not found\"); now that a missing REMOVED target is a\n    // no-op, the conflict must be rejected explicitly. Compared folded, so\n    // a case/whitespace variant cannot slip past the guard and degrade\n    // into a warned no-op.\n    const removedFoldMatch = [...removedNamesSet].find(\n      (r) => foldRequirementName(r) === foldRequirementName(fromNorm)\n    );\n    if (removedFoldMatch !== undefined) {\n      throw new Error(\n        `${specName} validation failed - requirement present in multiple sections (RENAMED and REMOVED) for header \"### Requirement: ${from}\"` +\n          (removedFoldMatch === fromNorm ? '' : ` (REMOVED spells it \"${removedFoldMatch}\")`)\n      );\n    }\n    if (modifiedNames.has(fromNorm)) {\n      throw new Error(\n        `${specName} validation failed - when a rename exists, MODIFIED must reference the NEW header \"### Requirement: ${to}\"`\n      );\n    }\n    // Detect ADDED colliding with a RENAMED TO\n    if (addedNames.has(toNorm)) {\n      throw new Error(\n        `${specName} validation failed - RENAMED TO header collides with ADDED for \"### Requirement: ${to}\"`\n      );\n    }\n  }\n  if (conflicts.length > 0) {\n    const c = conflicts[0];\n    throw new Error(\n      `${specName} validation failed - requirement present in multiple sections (${c.a} and ${c.b}) for header \"### Requirement: ${c.name}\"`\n    );\n  }\n  const hasAnyDelta = plan.added.length + plan.modified.length + plan.removed.length + plan.renamed.length > 0;\n  if (!hasAnyDelta) {","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L258-L294","documentation":"Error \"${specName} validation failed - when a rename exists, MODIFIED must reference the NEW header \"### Requirement: ${to}\"\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/specs-apply.ts:276 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"}