Troubleshooting
Overview
| Aspect | Details |
|---|---|
| Purpose | Consolidated error code reference and troubleshooting guide. |
| Audience | Users encountering errors during evaluate, run, or verify commands. |
| Exit codes | 0=success, 1=generic failure, 2=schema/config invalid, 3=hard abort (CI/Release). |
| Source of truth | src/invarlock/cli/commands/run.py, src/invarlock/cli/commands/verify.py. |
Quick Start
# Check environment and configuration
invarlock doctor --config <config.yaml> --profile ci
# Validate a report
invarlock verify reports/eval/evaluation.report.json --profile ci
# Enable debug output for detailed traces
INVARLOCK_DEBUG_TRACE=1 invarlock run -c <config.yaml>
Error Code Reference
Pairing Errors (E001–E006)
These errors relate to window pairing, tokenizer consistency, and evidence integrity.
E001 — Pairing Schedule Mismatch
| Field | Value |
|---|---|
| Code | E001 |
| Category | Pairing |
| Severity | Hard abort in CI/Release |
| Exit code | 3 (CI/Release) or 1 (dev) |
Triggers:
PAIRING-EVIDENCE-MISSING: Baseline report path does not exist or cannot be parsedPAIRING-SCHEDULE-MISMATCH: Window matching fraction ≠ 1.0, window overlap > 0, or counts diverge after stratificationPAIRED-WINDOWS-COLLAPSED:paired_windows ≤ 0under paired baseline
Common causes:
- Missing or corrupted baseline
report.json - Baseline lacks
evaluation_windowssection - Dataset settings differ between baseline and subject runs
- Sequence length / stride mismatch
Fixes:
- Ensure baseline
report.jsonexists and containsevaluation_windows - Verify dataset settings match:
provider,seq_len,stride,split - Regenerate baseline with the same configuration
- Check that tokenizer hash matches between runs
Example error:
[INVARLOCK:E001] PAIRING-SCHEDULE-MISMATCH: window_match_fraction=0.950
E002 — Tokenizer Digest Mismatch
| Field | Value |
|---|---|
| Code | E002 |
| Category | Pairing |
| Severity | Hard abort in CI/Release |
| Exit code | 3 (CI/Release) |
Triggers:
- Subject and baseline tokenizers produce different vocabulary hashes
Common causes:
- Different tokenizer versions or configurations
- Model updated with new vocabulary
- Trust-remote-code flag inconsistency
Fixes:
- Ensure both runs use the same model checkpoint
- Pin tokenizer version via
revisionin config - Regenerate baseline with current tokenizer
Example error:
[INVARLOCK:E002] TOKENIZER-DIGEST-MISMATCH: subject and baseline tokenizers differ
E003 — Mask Parity Mismatch
| Field | Value |
|---|---|
| Code | E003 |
| Category | Pairing |
| Severity | Hard abort in CI/Release |
| Exit code | 3 (CI/Release) |
Triggers:
- MLM mask positions differ between subject and baseline under identical tokenizers
Common causes:
- Different masking seeds between runs
- Baseline generated with different
mask_probormask_seed - Labels in baseline report corrupted or missing
Fixes:
- Ensure
eval.loss.seedmatches between runs - Regenerate baseline with consistent masking configuration
- Verify baseline contains MLM labels in
evaluation_windows
Example error:
[INVARLOCK:E003] MASK-PARITY-MISMATCH: mask positions differ under matched tokenizers
E004 — Provider Digest Missing
| Field | Value |
|---|---|
| Code | E004 |
| Category | Pairing |
| Severity | Hard abort in CI/Release |
| Exit code | 3 (CI/Release) |
Triggers:
- Subject or baseline is missing the provider digest (ids/tokenizer hash)
Common causes:
- Old baseline report generated before digest tracking was added
- Report truncated or missing
provenancesection - Windows not materialized due to
INVARLOCK_STORE_EVAL_WINDOWS=0
Fixes:
- Regenerate baseline with current InvarLock version
- Ensure
INVARLOCK_STORE_EVAL_WINDOWS=1(default) - Check
report.provenance.provider_digestexists
Example error:
[INVARLOCK:E004] PROVIDER-DIGEST-MISSING: subject or baseline missing ids/tokenizer digest
E006 — Window IDs Digest Mismatch
| Field | Value |
|---|---|
| Code | E006 |
| Category | Pairing |
| Severity | Hard abort in CI/Release |
| Exit code | 3 (CI/Release) |
Triggers:
- Subject and baseline window IDs differ (different windows selected)
Common causes:
- Different dataset splits or stratification seeds
- Capacity constraints forced window reduction
- Baseline generated with different
preview_n/final_n
Fixes:
- Use identical
dataset.seedand window counts - Verify capacity allows requested windows
- Regenerate baseline with matching configuration
Example error:
[INVARLOCK:E006] IDS-DIGEST-MISMATCH: subject and baseline window IDs differ
Primary Metric Errors (E111)
E111 — Primary Metric Degraded
| Field | Value |
|---|---|
| Code | E111 |
| Category | Quality |
| Severity | report emitted, then hard abort in CI/Release |
| Exit code | 3 (CI/Release) |
Triggers:
- Primary metric (perplexity/accuracy) is non-finite (NaN, Inf)
- Primary metric degraded beyond acceptable ratio
Common causes:
- Numerical instability (overflow/underflow)
- Model weights corrupted by edit
- Insufficient precision (try float32)
- Empty or malformed evaluation windows
Fixes:
- Force
dtype: float32in model config - Reduce batch size if memory-constrained
- Use an accelerator (CUDA/MPS) for better precision
- Lower
plan.max_modulesto reduce edit scope - Check that evaluation windows contain valid tokens
Example error:
[INVARLOCK:E111] Primary metric degraded or non-finite (preview=inf, final=nan)
Notes:
invarlock evaluatealways emits a report before exiting on E111invarlock runlogs a warning for non-finite PM but does not raise E111
Verification Errors (E601)
E601 — report Verification Failed
| Field | Value |
|---|---|
| Code | E601 |
| Category | Verification |
| Severity | Hard abort |
| Exit code | 3 |
Triggers:
- report fails schema validation
- Pairing math recomputation fails
- Gate checks fail in CI/Release profile
Common causes:
- report JSON corrupted or hand-edited
- Schema version mismatch (
schema_version≠v1) - Missing required fields (
run_id,meta,dataset, etc.)
Fixes:
- Regenerate report via
invarlock report --format report - Ensure report is unmodified from generation
- Check
schema_versionis"v1"
Example error:
[INVARLOCK:E601] report schema validation failed
Exit Code Summary
| Exit Code | Meaning | Typical causes |
|---|---|---|
0 | Success | Run/verification passed all gates |
1 | Generic failure | Unknown error, missing dependencies |
2 | Schema/config invalid | YAML parse error, invalid config keys, ValidationError |
3 | Hard abort | E001–E006, E111, E601 in CI/Release profile |
Common Issues
Network Blocked
Symptom: Downloads fail silently or model loading hangs.
Fix:
INVARLOCK_ALLOW_NETWORK=1 invarlock evaluate --baseline gpt2 --subject gpt2
Dependency Missing
Symptom: ModuleNotFoundError for torch, transformers, etc.
Fix:
pip install "invarlock[hf]" # HF adapters + eval
pip install "invarlock[guards]" # Guard math
pip install "invarlock[adapters]" # All adapters
Calibration Data Not Indexable
Symptom: Runner fails with "calibration data must be indexable."
Fix:
INVARLOCK_ALLOW_CALIBRATION_MATERIALIZE=1 invarlock run -c <config.yaml>
Guard Prepare Failures
Symptom: Guard initialization fails in strict mode.
Fix (local debugging only):
context:
run:
strict_guard_prepare: false
Non-Finite Metrics on CPU
Symptom: Perplexity returns inf or nan on CPU runs.
Fixes:
- Use an accelerator when available:
--device cudaor--device mps - Force higher precision:
dtype: float32in config - Reduce edit scope or batch size
Debug Tools
Doctor Command
Run comprehensive environment checks:
invarlock doctor --config <config.yaml> --profile ci --strict
Debug Trace
Enable detailed logging:
INVARLOCK_DEBUG_TRACE=1 invarlock run -c <config.yaml>
Plugins Inspection
List available adapters/guards/edits:
invarlock plugins list --verbose
invarlock plugins adapters --explain hf_causal