Documentation System Troubleshooting Guide¶
Version: 2.1 | Last Updated: 2026-01-06 | Status: Stable
Overview¶
This guide provides solutions to common problems when using the MBPanel documentation system. Covers MkDocs build issues, mkdocstrings parsing errors, cache corruption, git hook problems, and CI/CD failures.
Problem Resolution Flowchart¶
graph TD
A[Documentation Problem] --> B{Can build locally?}
B -->|Yes| C[Git or CI issue]
B -->|No| D{Error type?}
D -->|MkDocs build error| E[MkDocs Issue]
D -->|mkdocstrings error| F[mkdocstrings Issue]
D -->|Cache error| G[Cache Issue]
D -->|Hook error| H[Git Hook Issue]
C --> I[Check Git hooks]
C --> J[Review CI configuration]
E --> K[Check mkdocs.yml syntax]
E --> L[Verify file paths]
F --> M[Check Python syntax]
F --> N[Review docstrings]
G --> O[Clear cache]
G --> P[Rebuild index]
H --> Q[Reinstall hooks]
H --> R[Check permissions]
style A fill:#ffecb3
style E fill:#ffcdd2
style F fill:#ffcdd2
style G fill:#fff9c4
style H fill:#e1bee7
MkDocs Build Issues¶
Problem: "Config value error" in mkdocs.yml¶
Symptom:
Diagnosis:
- YAML syntax error in mkdocs.yml
- Plugin not installed
- Incorrect plugin configuration
Resolution:
-
Validate YAML syntax:
-
Check plugin installation:
-
Fix common YAML errors:
-
Reinstall if missing:
Problem: "Page not found" errors¶
Symptom:
Diagnosis:
- File path in mkdocs.yml doesn't match actual file
- File not committed to git
- Case sensitivity issue (Linux)
Resolution:
-
Verify file exists:
-
Check case sensitivity:
-
Update mkdocs.yml with correct path:
-
Stage and commit:
Problem: Build fails with "Template not found"¶
Symptom:
Diagnosis: - Template file missing - Template directory not configured - Wrong template path in code
Resolution:
-
Verify template exists:
-
Check template directory configuration:
-
Recreate template if missing:
# Copy from backup or recreate cat > tools/docs/templates/adr.md.j2 << 'EOF' # ADR {{ number }}: {{ title }} **Status:** {{ status }} **Date:** {{ date }} ## Context {{ context }} ## Decision {{ decision }} ## Consequences {{ consequences }} {% if alternatives %} ## Alternatives Considered {% for alt in alternatives %} ### {{ alt.name }} {{ alt.description }} **Pros:** {% for pro in alt.pros %} - {{ pro }} {% endfor %} **Cons:** {% for con in alt.cons %} - {{ con }} {% endfor %} {% endfor %} {% endif %} {% if related_documents %} ## Related Documents {% for doc in related_documents %} - [{{ doc.title }}]({{ doc.link }}) ({{ doc.type }}) {% endfor %} {% endif %} --- *This ADR was created on {{ created_at }}* EOF
mkdocstrings Parsing Errors¶
Problem: "ImportError" when generating API docs¶
Symptom:
Diagnosis: - Module not in Python path - Circular import - Missing dependency
Resolution:
-
Set PYTHONPATH:
-
Install backend package:
-
Check for circular imports:
Problem: "AttributeError" when rendering docstrings¶
Symptom:
Diagnosis: - Module structure changed - Incorrect module path - Missing init.py
Resolution:
-
Verify module structure:
-
Test import:
-
Use correct module path:
Problem: mkdocstrings generates empty docs¶
Symptom: - API docs file created but empty - Only module title, no content
Diagnosis: - No docstrings in module - Docstring style mismatch - Private module (all names start with _)
Resolution:
-
Check for docstrings:
-
Verify docstring style:
-
Check mkdocstrings configuration:
Cache Corruption Issues¶
Problem: Build cache returns stale data¶
Symptom: - Changes not reflected in output - Old template used despite updates - File says "cached" but is outdated
Diagnosis: - Cache not invalidated properly - Cache file corrupted - Concurrent write corrupted cache
Resolution:
-
Clear cache completely:
-
Force full rebuild:
-
Check for corruption:
# Validate cache JSON python -c " import json from pathlib import Path cache_path = Path('docs/.build_cache.json') try: data = json.loads(cache_path.read_text()) print('Cache valid') print(f'Version: {data.get(\"cache_version\")}') print(f'Files: {len(data.get(\"files\", {}))}') except json.JSONDecodeError as e: print(f'Cache corrupted: {e}') print('Remove and rebuild') "
Problem: "IndexCorruptedError" when building index¶
Symptom:
Diagnosis: - Index file partially written - Disk full during write - Process killed during write
Resolution:
-
Remove corrupted index:
-
Rebuild from scratch:
-
Check disk space:
Problem: Cache grows too large¶
Symptom: - Cache file > 100MB - Slow cache operations - High memory usage
Diagnosis: - Too many tracked files - Large files cached - Cache not pruning old entries
Resolution:
-
Check cache size:
# Check file size ls -lh docs/.build_cache.json # Count tracked files python -c " import json from pathlib import Path cache = json.loads(Path('docs/.build_cache.json').read_text()) print(f'Tracked files: {len(cache[\"files\"])}') print(f'Templates: {len(cache[\"templates\"])}') print(f'Config entries: {len(cache[\"config\"])}') " -
Clear and rebuild:
-
Add cache size limits:
# In BuildCache class, add pruning: def prune_old_entries(self, max_files: int = 10000): """Remove oldest entries if cache too large.""" if len(self.cache['files']) > max_files: # Sort by last accessed sorted_files = sorted( self.cache['files'].items(), key=lambda x: x[1].get('last_accessed', 0) ) # Remove oldest for path, _ in sorted_files[:len(sorted_files) - max_files]: del self.cache['files'][path]
Git Hook Problems¶
Problem: Pre-commit hook blocks valid commits¶
Symptom:
Diagnosis: - "TODO/FIXME" in documentation - Broken internal link - Missing frontmatter fields
Resolution:
-
Find and fix action items:
-
Fix broken internal links:
-
Add missing frontmatter:
Problem: Git hooks not executing¶
Symptom: - Commits succeed without validation - Post-merge hook doesn't run
Diagnosis: - Hooks not installed - Not executable - Skipped with --no-verify
Resolution:
-
Verify hooks installed:
-
Make executable:
-
Reinstall hooks:
-
Test hooks:
Problem: Post-merge hook fails after git pull¶
Symptom:
Diagnosis: - Python not in PATH - Wrong Python binary - Virtualenv not activated
Resolution:
-
Set Python binary:
-
Activate virtualenv (if using):
-
Skip hook temporarily:
CI/CD Workflow Failures¶
Problem: Docs build fails in CI but works locally¶
Symptom: - CI pipeline fails at documentation build step - Same command succeeds locally
Diagnosis: - Missing dependencies in CI - Different Python version - Environment variables not set - File permissions issue
Resolution:
-
Check CI dependencies:
-
Verify Python version:
-
Check environment variables:
-
Compare environments:
Problem: mkdocstrings fails in CI with module not found¶
Symptom:
Diagnosis: - PYTHONPATH not set in CI - Backend not installed as package - Working directory different
Resolution:
-
Set PYTHONPATH in CI:
-
Install backend package:
-
Use absolute paths:
Problem: Git hooks fail in CI¶
Symptom:
Diagnosis: - Hooks not executable in CI - Hooks not installed in CI environment - Different shell in CI
Resolution:
-
Skip hooks in CI:
-
Install hooks in CI:
-
Make hooks executable:
Performance Issues¶
Problem: Slow documentation builds¶
Symptom:
- mkdocs build takes > 5 minutes
- CLI commands hang
Diagnosis: - Large documentation set - No incremental builds - Expensive operations in hooks
Resolution:
-
Use incremental builds:
-
Disable expensive hooks:
-
Optimize mkdocs configuration:
-
Use build cache:
Problem: Memory errors during build¶
Symptom:
or process killed with OOMDiagnosis: - Large test files loaded entirely - Many documents in memory - Memory leak in generator
Resolution:
-
Use streaming for large files:
-
Limit concurrent operations:
-
Increase swap space:
Error Reference Table¶
| Error | Cause | Resolution |
|---|---|---|
Config value error |
Invalid mkdocs.yml | Validate YAML, check plugin installation |
Page not found |
Missing file or wrong path | Verify file exists, update mkdocs.yml |
Template not found |
Missing template file | Recreate template in tools/docs/templates/ |
ModuleNotFoundError |
Module not in PYTHONPATH | Set PYTHONPATH or install backend package |
IndexCorruptedError |
Corrupted cache/index | Delete .build_cache.json, rebuild |
Permission denied |
Git hook not executable | chmod +x .git/hooks/pre-commit |
MemoryError |
Large file in memory | Use streaming, reduce file size |
ImportError |
Missing dependency | pip install required packages |
AttributeError |
Wrong module path | Verify module structure and path |
JSONDecodeError |
Corrupted JSON file | Validate JSON, recreate from scratch |
Getting Help¶
If problems persist:
-
Check logs:
-
Verify installation:
-
Reinstall from scratch:
-
Check for updates: