Fission-AI/OpenSpec · error
: target spec does not exist; only ADDED requirements are…
Error message
${specName}: target spec does not exist; only ADDED requirements are allowed for new specs. MODIFIED and RENAMED operations require an existing spec. What it means
Thrown in buildUpdatedSpec when the change delta references an existing spec (via MODIFIED/REMOVED/RENAMED) but the target spec file does not exist in the specs directory. Only ADDED is legal for creating a brand-new spec.
Solutions
- Change the delta operations to ADDED if this is genuinely a new spec
- Fix the spec name/path in the change spec so it matches an existing spec file
- Create the target spec first, then apply the change
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/core/specs-apply.ts:327 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/dd5079a21e02be2e.
Report an issue: GitHub.
Appendix: source
Thrown at src/core/specs-apply.ts:327
// than dropping it silently - the specs instruction tells authors to write
// one for new capabilities, and the delta file looks identical either way.
// Only when the spec really does have a different Purpose: claiming it
// "already has one" would be false when it has none, and saying anything at
// all is noise when the two bodies match.
if (deltaPurpose) {
const existingPurpose = extractPurposeSection(targetContent);
if (existingPurpose && existingPurpose !== deltaPurpose) {
warn(
`${specName} - delta Purpose ignored; ${specName} already has one. ` +
`Edit ${update.target} directly to change it.`
);
}
}
} catch {
// Target spec does not exist; MODIFIED and RENAMED are not allowed for new specs
// REMOVED will be ignored with a warning since there's nothing to remove
if (plan.modified.length > 0 || plan.renamed.length > 0) {
throw new Error(
`${specName}: target spec does not exist; only ADDED requirements are allowed for new specs. MODIFIED and RENAMED operations require an existing spec.`
);
}
// Warn about REMOVED requirements being ignored for new specs
if (plan.removed.length > 0) {
warn(
`${specName} - ${plan.removed.length} REMOVED requirement(s) ignored for new spec (nothing to remove).`
);
}
isNewSpec = true;
targetContent = buildSpecSkeleton(specName, changeName, deltaPurpose);
const overview = deltaPurpose ? readableOverview(targetContent, specName) : null;
if (deltaPurpose && !overview) {
// Keep the placeholder rather than turning this into a failure: these
// deltas archived cleanly before the Purpose carry-over existed.
targetContent = buildSpecSkeleton(specName, changeName);
warn(
`${specName} - delta Purpose ignored (it would leave the new spec unreadable); wrote the placeholder Purpose instead.`View on GitHub (pinned to 6926ccb18a)