This document defines all validation rules for the manifest-driven content generator and their associated error messages.
Validation occurs in three phases:
- Manifest Structure Validation - Check manifest file format and structure
- File Existence Validation - Verify all referenced files exist
- Configuration Validation - Validate extraction configurations
- Template Matching Validation - Ensure template placeholders match extractions
Check: Manifest file must be valid YAML format.
Error Message:
ERROR: Invalid YAML syntax in manifest file
File: manifest.yml
Details: [YAML parser error message]
Fix: Use a YAML validator to identify syntax errors.
Check: Manifest must contain documents key.
Error Message:
ERROR: Missing required key 'documents' in manifest
File: manifest.yml
Expected structure:
documents:
output/file.md:
...
Fix: Add the documents section to your manifest.
Check: Each document must have template and extractions keys.
Error Message:
ERROR: Invalid document configuration for 'output/website.md'
Missing required key: 'template'
Expected structure:
documents:
output/website.md:
template: website.md
extractions:
...
Fix: Ensure each document has both template and extractions defined.
Check: If primary_source is specified, the file must exist.
Error Message:
ERROR: Primary source file not found
File: ../merged/Guide Template.md
Please verify:
1. The file path is correct
2. The file exists at the specified location
3. You have read permissions
Fix: Verify the path to your primary source file.
Check: Template file specified for each document must exist.
Error Message:
ERROR: Template file not found for document 'output/website.md'
Template: website.md
Searched in: tools/content-generator/
Please verify:
1. Template file exists
2. Template path is correct (relative to manifest)
Fix: Create the template file or correct the path.
Check: If an extraction specifies a custom source, that file must exist.
Error Message:
ERROR: Source file not found for extraction 'objectives'
File: custom-source.md
Document: output/website.md
Either:
1. Create the file at the specified path, or
2. Remove the 'source' key to use primary_source, or
3. Correct the file path
Fix: Verify the source file exists or use the primary source.
Check: Each extraction must have a pattern parameter.
Error Message:
ERROR: Missing required parameter 'pattern'
Document: output/website.md
Extraction: objectives
Required structure:
objectives:
pattern: "#### Objectives"
scope: bullets
Fix: Add the pattern parameter to your extraction.
Check: Each extraction must have a scope parameter.
Error Message:
ERROR: Missing required parameter 'scope'
Document: output/website.md
Extraction: topics
Required structure:
topics:
pattern: "## "
scope: self_plain
Fix: Add the scope parameter to your extraction.
Check: Scope must be one of the supported types.
Valid Values:
self,self_plainbullets,bullets_plaintext,text_plaincode,code_plainall,all_plain
Error Message:
ERROR: Invalid scope value 'bullet' for extraction 'objectives'
Document: output/website.md
Valid scope values:
- self, self_plain
- bullets, bullets_plain
- text, text_plain
- code, code_plain
- all, all_plain
Did you mean: bullets?
Fix: Use a valid scope value from the list above.
Check: If specified, format must be one of the supported types.
Valid Values:
markdown-list(default)plain-listinline
Error Message:
ERROR: Invalid format value 'bullet-list' for extraction 'objectives'
Document: output/website.md
Valid format values:
- markdown-list (default)
- plain-list
- inline
Did you mean: markdown-list?
Fix: Use a valid format value or omit for default.
Check: Pattern cannot be an empty string.
Error Message:
ERROR: Empty pattern value for extraction 'topics'
Document: output/website.md
Pattern must be a non-empty string that matches line content.
Examples:
- "## "
- "#### Objectives"
- "# Module"
Fix: Provide a valid pattern string.
Check: Template file should contain placeholder markers.
Warning Message:
WARNING: Template file contains no placeholders
Template: website.md
Document: output/website.md
Expected format in template:
//Generated by content-generator
//extraction_key
This document will be created but no content will be inserted.
Fix: Add placeholder markers to your template.
Check: Placeholders must follow the two-line comment format.
Error Message:
ERROR: Invalid placeholder format in template
Template: website.md
Line: 27
Found: //objectives
Expected format:
//Generated by content-generator
//objectives
Placeholders must be preceded by '//Generated by content-generator'
Fix: Ensure placeholders follow the two-line format.
Check: All extraction keys should have corresponding placeholders in template.
Warning Message:
WARNING: Extraction defined but no matching placeholder in template
Document: output/website.md
Extraction: 'objectives'
Template: website.md
Expected to find in template:
//Generated by content-generator
//objectives
This extraction will be processed but not inserted into output.
Fix: Add matching placeholder to template or remove unused extraction.
Check: All template placeholders should have matching extraction configs.
Warning Message:
WARNING: Placeholder in template has no matching extraction
Template: website.md
Placeholder: //agenda
Document: output/website.md
Either:
1. Add extraction configuration for 'agenda', or
2. Remove the placeholder from template
The placeholder will remain unchanged in output.
Fix: Add extraction config or remove placeholder.
When validation completes, a summary is displayed:
✓ Validation passed
Documents: 1
Extractions: 2
Templates verified: 1
Ready to generate content.
✓ Validation passed with warnings
Documents: 1
Extractions: 2
Warnings: 1
See warnings above. Content generation will continue.
✗ Validation failed
Documents: 1
Errors: 3
Fix the errors above before generating content.
To validate manifest without generating content:
node generator.js --validateThis runs all validation phases and reports errors/warnings without processing.
- Invalid YAML syntax
- Missing required keys
- Missing required parameters
- Invalid parameter values
- File not found errors
- Missing placeholders for extractions
- Missing extractions for placeholders
- Empty template file
- No patterns found in source
- Always validate before committing - Run
--validateflag - Fix warnings - They often indicate configuration issues
- Use descriptive extraction keys - Match them to template placeholders
- Test with small documents first - Verify behavior before scaling up
- Keep manifest organized - Group related extractions together
Check:
- Pattern matches lines in source (case-sensitive!)
- Scope is appropriate for content type
- Collection boundary isn't immediately after pattern
- Placeholder exists in template
Check:
- Pattern is specific enough (e.g., "## " matches ALL H2)
- Scope type matches content (bullets vs text vs code)
- Collection stops at next heading as expected
Check:
- Placeholder key matches extraction key exactly
- Placeholder follows two-line format
- Template file is being used for correct document