{"record":{"id":"91d278c4d7c08ef1","repo":"Fission-AI/OpenSpec","slug":"specname-renamed-failed-for-header-require-91d278","errorCode":null,"errorMessage":"${specName} RENAMED failed for header \"### Requirement: ${r.from}\" - source not found","messagePattern":"(.+?) RENAMED failed for header \"### Requirement: (.+?)\" - source not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/specs-apply.ts","lineNumber":400,"sourceCode":"    if (!nameToBlock.has(from)) {\n      // Source gone but target present means the rename was already synced\n      // to the baseline (early-sync pattern) — re-applying it is a no-op,\n      // not a failure. Only a missing source AND target is a genuine error.\n      if (nameToBlock.has(to)) {\n        // Unless a case/whitespace variant of the source still exists (and is\n        // not the target itself, as in a case-only rename): that is a typo'd\n        // header, not an early-synced rename — same guard REMOVED applies.\n        const nearMiss = [...nameToBlock.keys()].find(\n          (k) => k !== to && foldRequirementName(k) === foldRequirementName(from)\n        );\n        if (nearMiss !== undefined) {\n          throw new Error(\n            `${specName} RENAMED failed for header \"### Requirement: ${r.from}\" - source not found, but \"### Requirement: ${nameToBlock.get(nearMiss)!.name}\" exists; fix the header to match it exactly`\n          );\n        }\n        continue;\n      }\n      throw new Error(`${specName} RENAMED failed for header \"### Requirement: ${r.from}\" - source not found`);\n    }\n    if (nameToBlock.has(to)) {\n      throw new Error(`${specName} RENAMED failed for header \"### Requirement: ${r.to}\" - target already exists`);\n    }\n    const block = nameToBlock.get(from)!;\n    const newHeader = `### Requirement: ${to}`;\n    const rawLines = block.raw.split('\\n');\n    rawLines[0] = newHeader;\n    const renamedBlock: RequirementBlock = {\n      headerLine: newHeader,\n      name: to,\n      raw: rawLines.join('\\n'),\n    };\n    nameToBlock.delete(from);\n    nameToBlock.set(to, renamedBlock);\n    renamedTargets.set(from, to);\n    renamedApplied++;\n  }","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/core/specs-apply.ts#L382-L418","documentation":"Error \"${specName} RENAMED failed for header \"### Requirement: ${r.from}\" - source not found\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/core/specs-apply.ts:400 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"}