Fission-AI/OpenSpec · error · Error

Spec must have a Requirements section

Error message

Spec must have a Requirements section

What it means

Thrown by MarkdownParser.parseSpec when the 'Requirements' section is absent from a spec document. Structural validation ensuring every spec carries its requirements heading (Purpose was present but Requirements was not); the at-fault input is the spec markdown missing '## Requirements'.

Solutions

  1. Add a '## Requirements' section with the spec's requirement entries
  2. Check heading spelling and level (##)
  3. Ensure the section body is non-empty
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/parsers/markdown-parser.ts:39 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/83d9a70f0b751c11. Report an issue: GitHub.

Appendix: source

Thrown at src/core/parsers/markdown-parser.ts:39

  }

  protected static normalizeContent(content: string): string {
    // Strip a UTF-8 BOM so a header on the first line still matches.
    return content.replace(/^/, '').replace(/\r\n?/g, '\n');
  }

  parseSpec(name: string): Spec {
    const sections = this.parseSections();
    const purpose = this.findSection(sections, 'Purpose')?.content || '';
    
    const requirementsSection = this.findSection(sections, 'Requirements');
    
    if (!purpose) {
      throw new Error('Spec must have a Purpose section');
    }
    
    if (!requirementsSection) {
      throw new Error('Spec must have a Requirements section');
    }

    const requirements = this.parseRequirements(requirementsSection);

    return {
      name,
      overview: purpose.trim(),
      requirements,
      metadata: {
        version: '1.0.0',
        format: 'openspec',
      },
    };
  }

  parseChange(name: string): Change {
    const sections = this.parseSections();
    const why = this.findSection(sections, 'Why')?.content || '';

View on GitHub (pinned to 6926ccb18a)