Plugin Troubleshooting¶
This guide covers common issues, error messages, and their solutions when working with the Mistaber encoding plugin.
Quick Diagnostics¶
Before diving into specific issues, run these diagnostic commands:
#!/bin/bash
# quick-diagnose.sh - Run quick diagnostics
echo "=== Mistaber Plugin Diagnostics ==="
# Check session state
if [ -f ".mistaber-session.yaml" ]; then
echo "[Session] Active session found"
grep "current_phase:" .mistaber-session.yaml
grep "target_seif:" .mistaber-session.yaml
else
echo "[Session] No active session"
fi
# Check artifacts
if [ -d ".mistaber-artifacts" ]; then
echo "[Artifacts] $(ls .mistaber-artifacts | wc -l) files in artifacts"
else
echo "[Artifacts] No artifacts directory"
fi
# Check Python
python3 --version 2>/dev/null || echo "[Python] NOT FOUND"
# Check PyYAML
python3 -c "import yaml; print('[PyYAML] OK')" 2>/dev/null || echo "[PyYAML] NOT FOUND"
# Check Clingo
clingo --version 2>/dev/null | head -1 || echo "[Clingo] NOT FOUND"
# Check Mistaber
python3 -c "from mistaber.engine import HsrsEngine; print('[Mistaber] OK')" 2>/dev/null || echo "[Mistaber] NOT FOUND"
Hook-Related Issues¶
BLOCKED: No Active Encoding Session¶
Error Message:
BLOCKED: No Active Encoding Session
Cannot write to ontology file: mistaber/ontology/corpus/yd_87/base.lp
You must start an encoding session first:
1. Invoke the corpus-prep skill
2. Complete corpus preparation
3. Get human approval at checkpoint
Start with: "Prepare corpus for YD {siman}:{seif}"
Cause: The phase-gate hook detected an attempt to write to ontology files without an active encoding session.
Solutions:
-
Start a proper encoding session:
-
If session exists but state is corrupted:
-
If writing non-ontology files: Verify the file path does not match the ontology pattern (
*ontology*corpus*.lp).
BLOCKED: Checkpoint Not Approved¶
Error Message:
BLOCKED: Checkpoint Not Approved
Cannot write to: mistaber/ontology/corpus/yd_87/seif_3.lp
Required checkpoint: corpus-prep
Current status: pending_review
The encoding workflow requires human approval at each checkpoint.
Complete the corpus-prep phase and get approval before proceeding.
Cause: The phase-gate hook detected an attempt to proceed past an unapproved checkpoint.
Solutions:
-
Review and approve the pending checkpoint:
-
Check current checkpoint status:
-
If checkpoint was approved but state not updated: Manually update
.mistaber-session.yaml:
BLOCKED: HLL Encoding Validation Failed¶
Error Message:
BLOCKED: HLL Encoding Validation Failed
File: mistaber/ontology/corpus/yd_87/seif_3.lp
Issues Found:
- Rule 'r_bb_dag_sakana' uses normative predicate but has no makor
- Unknown world referenced: 'mechaver' (typo of 'mechaber')
Please fix these issues before writing the file.
Encoding Requirements:
- All normative rules must have @makor attribution
- All worlds must be valid (base, mechaber, rema, etc.)
- All predicates must exist in the registry
Cause: The encoding-guard hook found validation errors in the HLL content.
Solutions:
-
Add missing makor attribution:
-
Fix typos in world names:
-
Register new predicates if needed: Add to
mistaber/ontology/schema/sorts.lpbefore using.
BLOCKED: Commit Without Approval¶
Error Message:
BLOCKED: Review Not Approved
Cannot commit ontology files without approved review.
Staged ontology files:
- mistaber/ontology/corpus/yd_87/seif_3.lp
- mistaber/ontology/worlds/mechaber.lp
Current checkpoint status:
- corpus-prep: approved
- hll-encode: approved
- validate: approved
- review: pending_review
Complete the remaining checkpoints before committing.
Cause: The git-commit-guard hook detected a commit attempt without all required approvals.
Solutions:
-
Complete the review checkpoint:
-
Check which checkpoints are missing:
-
If committing non-ontology files: The guard only blocks when
.lpfiles inontology/are staged. To commit other files:
Session State Issues¶
Corrupted Session File¶
Symptoms: - Hooks produce parsing errors - Inconsistent checkpoint statuses - Skills don't recognize session state
Diagnostic:
Solutions:
-
Fix YAML syntax errors:
-
Reset to known good state:
-
Complete reset (loses all progress):
Session State Lost Between Sessions¶
Symptoms: - Session appears new when resuming work - Previous progress not recognized
Cause: Session file not persisted or deleted.
Solutions:
-
Verify file persistence:
-
Check for gitignore:
-
Add to git tracking (optional):
Multiple Concurrent Sessions¶
Symptoms: - Session state conflicts - Unexpected checkpoint statuses
Cause: Multiple encoding sessions or concurrent users.
Solutions:
-
Use one session at a time: Complete or archive current session before starting new one.
-
Check for orphaned sessions:
-
Archive completed sessions:
Sefaria MCP Issues¶
MCP Server Not Running¶
Symptoms: - Sefaria tool calls fail - "Connection refused" errors
Solutions:
-
Check MCP configuration:
-
Verify MCP server package:
-
Restart Claude Code session: Exit and restart to reinitialize MCP connections.
Invalid Reference Format¶
Symptoms: - "Reference not found" errors - Empty text returned
Solutions:
-
Validate reference format:
Use theclarify_name_argumenttool to get canonical format. -
Common format issues:
-
Check available versions: Some texts may not have English translations.
Source Logging Not Working¶
Symptoms:
- source-chain-log.yaml not updated
- No logging messages
Solutions:
-
Verify sefaria-logger hook:
-
Check artifacts directory:
-
Test logger manually:
Validation Issues¶
UNSAT (Unsatisfiable Rules)¶
Symptoms: - Clingo returns "UNSATISFIABLE" - No answer sets found
Cause: The encoded rules contain a logical contradiction.
Solutions:
-
Identify conflicting rules:
-
Check for direct contradictions:
-
Check for circular negation:
-
Use debugging output:
Grounding Errors¶
Symptoms: - "Grounding error" messages - "Unsafe variable" warnings
Solutions:
-
Fix unsafe variables:
-
Check infinite recursion:
-
Add domain bounds:
Test Failures¶
Symptoms: - Pytest reports failures - Unexpected query results
Solutions:
-
Review test expectations:
-
Run tests verbosely:
-
Test individual queries:
-
Check world inheritance:
Encoding Issues¶
Missing Predicates¶
Symptoms: - "Unknown predicate" errors - Validation failures
Solutions:
-
Check predicate registry:
-
Add predicate definition:
-
Update encoding-guard NORMATIVE_PREDICATES:
World Scoping Errors¶
Symptoms: - Rules not inheriting correctly - Override not taking effect
Solutions:
-
Verify world hierarchy:
-
Check override syntax:
-
Verify world exists:
Makor Chain Incomplete¶
Symptoms: - "Chain doesn't reach authoritative source" warnings - Missing Torah terminus
Solutions:
-
Complete the chain:
-
For d'rabanan rules:
Performance Issues¶
Slow Grounding¶
Symptoms: - Validation takes >10 seconds - Timeout errors
Solutions:
-
Reduce rule complexity:
-
Use projection:
-
Limit answer sets:
Memory Issues¶
Symptoms: - "Out of memory" errors - System slowdown
Solutions:
-
Ground incrementally:
-
Use Clingo memory limits:
-
Split large ontologies: Load only relevant portions during validation.
Debug Mode¶
Enabling Debug Output¶
For Hook Scripts:
This enables verbose logging in hook scripts:
import os
DEBUG = os.environ.get("MISTABER_DEBUG", "0") == "1"
if DEBUG:
print(f"[DEBUG] Phase gate checking: {file_path}", file=sys.stderr)
For Validation:
# Verbose Clingo output
clingo --verbose=2 ontology.lp
# Trace ASP execution
clingo --trace=asp ontology.lp
Log File Locations¶
| Log | Location | Content |
|---|---|---|
| Session log | .mistaber-artifacts/session.log |
Session events |
| Source log | .mistaber-artifacts/source-chain-log.yaml |
Sefaria fetches |
| Validation log | .mistaber-artifacts/validation.log |
Test results |
| Hook output | stderr | Hook debug messages |
Getting Help¶
Collecting Diagnostic Information¶
#!/bin/bash
# collect-diagnostics.sh
echo "=== Mistaber Diagnostics ===" > diagnostics.txt
echo "" >> diagnostics.txt
echo "## Environment" >> diagnostics.txt
python3 --version >> diagnostics.txt 2>&1
clingo --version >> diagnostics.txt 2>&1
echo "" >> diagnostics.txt
echo "## Session State" >> diagnostics.txt
cat .mistaber-session.yaml >> diagnostics.txt 2>&1 || echo "No session" >> diagnostics.txt
echo "" >> diagnostics.txt
echo "## Recent Artifacts" >> diagnostics.txt
ls -la .mistaber-artifacts/ >> diagnostics.txt 2>&1 || echo "No artifacts" >> diagnostics.txt
echo "" >> diagnostics.txt
echo "## Plugin Structure" >> diagnostics.txt
find mistaber-skills -name "*.md" -o -name "*.json" -o -name "*.py" | head -20 >> diagnostics.txt
echo "" >> diagnostics.txt
echo "Diagnostics collected in diagnostics.txt"
Reporting Issues¶
When reporting issues, include:
- Error message: Complete error output
- Session state: Contents of
.mistaber-session.yaml - Reproduction steps: How to trigger the issue
- Environment: Python version, Clingo version, OS
- Diagnostics output: Run
collect-diagnostics.sh
Community Resources¶
- GitHub Issues: github.com/BrainyBlaze/mistaber-skills/issues
- Documentation: github.com/BrainyBlaze/mistraber/docs
- Discussions: github.com/BrainyBlaze/mistraber/discussions