# Script Issues & Fixes - Frühschicht Post

**Last Updated:** 2026-03-16

## Issues Encountered

### 1. Missing Backup Script
**Script:** `v2/scripts/blog/backup-blog-content.py --manual`
**Issue:** Script not found (`[Errno 2] No such file or directory`)
**Status:** Skipped - backup functionality not available
**Workaround:** Manual backups created via `sync-meta-to-posts.php` (creates backup directory)

### 2. SISTRIX PAA Questions Off-Topic
**Script:** `v2/scripts/blog/run-new-post-pipeline.php`
**Issue:** SISTRIX PAA questions were 100% off-topic (job boards: indeed, stepstone, agentur für arbeit)
**Status:** Resolved
**Solution:** Created manual `paa-questions-manual.json` with 20 relevant Frühschicht-specific questions

### 3. FAQ Answer Generation Failed
**Script:** `v2/scripts/blog/generate-faq-answers-ai.php`
**Issue:** Failed with "OpenAI API key not configured"
**Status:** Resolved
**Solution:** Manually created `faq-answers-ai.json` with 15 detailed answers based on main post content

### 4. Missing Lead Capture Copy Mapping
**Script:** `v2/scripts/blog/generate-lead-capture-copy.php`
**Issue:** Failed with "Error: No benefit mapping for slug 'fruehschicht'"
**Status:** Resolved
**Solution:** 
- Added benefit mapping to `_slugToBenefit()` function in `generate-lead-capture-copy.php`
- Added feature mapping to `docs/data/blog-product-feature-mapping.json`

### 5. Image Scene Type Audit Script
**Script:** `v2/scripts/blog/audit-blog-image-scene-types.py`
**Issue:** Failed with `unrecognized arguments: --post=fruehschicht`
**Status:** Resolved
**Solution:** Created custom `IMAGE_PROMPT.md` file instead, then used `generate-blog-featured-image.py` with custom prompt

### 6. Documentation Generation Warnings
**Script:** `v2/scripts/blog/generate-post-documentation.php`
**Issue:** PHP warnings: `Undefined array key "has_introduction"` and `"has_conclusion"`
**Status:** Non-blocking
**Impact:** Documentation generated successfully despite warnings
**Note:** Script should check for these keys before accessing them

### 7. Lexikon Tracking Not Updated
**Script:** `v2/scripts/blog/update-lexikon-tracking.py`
**Issue:** fruehschicht not appearing in Covered section
**Status:** Expected behavior
**Reason:** fruehschicht may not be in `tmp/validated-recommendations-table.md` (the script only tracks terms from that file)
**Note:** Post exists and is valid; tracking file tracks specific validated recommendations

## Scripts That Worked Correctly

✅ `create-new-blog-post.php` - Scaffolded post successfully
✅ `run-new-post-pipeline.php` - Collected data (despite off-topic PAA)
✅ `generate-section-briefs.php` - Generated section briefs
✅ `check-outline-h2-overlap.php` - Validated outline
✅ `validate-improvement-readiness.php` - Validated readiness (after SERP_ANALYSIS.md completion)
✅ `validate-content-outline-quality.php` - Validated outline quality
✅ `update-post-content.php` - Applied content successfully
✅ `generate-faq-questions.php` - Generated FAQ questions (from manual research file)
✅ `add-faqs-to-post.php` - Added FAQs successfully
✅ `validate-faq-schema.php` - Validated FAQ schema
✅ `generate-blog-featured-image.py` - Generated featured image
✅ `compare-content-to-competitors.php` - Compared content (204% of target)
✅ `validate-section-depth.php` - Validated section depth
✅ `validate-content-completeness.php` - Validated completeness
✅ `validate-faq-quality.php` - Validated FAQ quality (100/100)
✅ `validate-new-post.php` - Validated new post (warnings only)
✅ `validate-content-flow.php` - Validated content flow
✅ `validate-link-quality.php` - Validated link quality
✅ `validate-anchor-text-quality.php` - Validated anchor text
✅ `validate-schema.php` - Validated schema
✅ `sync-meta-to-posts.php` - Synced SEO meta
✅ `generate-post-documentation.php` - Generated documentation (with warnings)

## Recommendations

1. **Backup Script:** Create or locate the backup script for manual backups
2. **PAA Quality:** Improve SISTRIX PAA filtering or add manual override workflow
3. **API Key Management:** Document OpenAI API key setup for FAQ generation
4. **Documentation Script:** Fix undefined array key warnings in `generate-post-documentation.php`
5. **Tracking Script:** Consider adding ability to track posts not in validated recommendations table
