{"record":{"id":"767594b619ed6bc6","repo":"Fission-AI/OpenSpec","slug":"specname-modified-failed-for-header-requir","errorCode":null,"errorMessage":"${specName} MODIFIED failed for header \"### Requirement: ${mod.name}\" - not found","messagePattern":"(.+?) MODIFIED failed for header \"### Requirement: (.+?)\" - not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":454,"sourceCode":"          );\n        }\n        warn(\n          `${specName} - REMOVED requirement \"${name}\" is not in the current spec; treating it as already removed.`\n        );\n      }\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.","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L436-L472","documentation":"Error \"${specName} MODIFIED failed for header \"### Requirement: ${mod.name}\" - not found\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/specs-apply.ts:454 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"}