{"record":{"id":"6bccdef4422d750a","repo":"Fission-AI/OpenSpec","slug":"specname-modified-failed-for-header-requir-6bccde","errorCode":null,"errorMessage":"${specName} MODIFIED failed for header \"### Requirement: ${mod.name}\" - header mismatch in content","messagePattern":"(.+?) MODIFIED failed for header \"### Requirement: (.+?)\" - header mismatch in content","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":459,"sourceCode":"      }\n      continue;\n    }\n    nameToBlock.delete(key);\n    removedApplied++;\n  }\n\n  // MODIFIED\n  let modifiedApplied = 0;\n  for (const mod of plan.modified) {\n    const key = normalizeRequirementName(mod.name);\n    const currentBlock = nameToBlock.get(key);\n    if (!currentBlock) {\n      throw new Error(`${specName} MODIFIED failed for header \"### Requirement: ${mod.name}\" - not found`);\n    }\n    // Replace block with provided raw (ensure header line matches key)\n    const modHeaderMatch = mod.raw.split('\\n')[0].match(/^###\\s*Requirement:\\s*(.+)\\s*$/i);\n    if (!modHeaderMatch || normalizeRequirementName(modHeaderMatch[1]) !== key) {\n      throw new Error(\n        `${specName} MODIFIED failed for header \"### Requirement: ${mod.name}\" - header mismatch in content`\n      );\n    }\n    const missingScenarios = findMissingCurrentScenarios(currentBlock, mod);\n    if (missingScenarios.length > 0) {\n      throw new Error(\n        `${specName} MODIFIED failed for header \"### Requirement: ${mod.name}\" - current spec contains scenario(s) not present in the modified block: ${missingScenarios.map(name => `\"${name}\"`).join(', ')}. Refresh the change spec before archiving to avoid dropping scenarios.`\n      );\n    }\n    // Identical content means the modification was already synced to the\n    // baseline (early-sync pattern) — count only real replacements, so a\n    // fully synced change still takes the \"already in sync\" write skip\n    // instead of churning normalization differences into the file.\n    if (normalizeBlockRaw(currentBlock.raw) !== normalizeBlockRaw(mod.raw)) {\n      modifiedApplied++;\n    }\n    nameToBlock.set(key, mod);\n  }","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L441-L477","documentation":"Error \"${specName} MODIFIED failed for header \"### Requirement: ${mod.name}\" - header mismatch in content\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/specs-apply.ts:459 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"}