HEAV3NS-JOY errors and diagnostics are typed, deterministic, and actionable.
Every operational error thrown by BroccoliRuntime, RuntimeStateGraph, or NodeCasStorage is an instance of GuidedError containing structured operator guidance:
| Field | Description |
|---|---|
code |
Machine-readable error code (LIFECYCLE_STATE_ERROR, POLICY_BLOCKED, etc.) |
message |
Multi-line formatted summary including Cause, Fix, Try, and Docs |
guidance.likelyCause |
Why this error occurred |
guidance.suggestedFix |
Concrete remediation step |
guidance.command |
Suggested CLI command (when applicable) |
guidance.docsPath |
Link to relevant specification |
- When: A
BroccoliRuntimemethod (beginSession,planRepairs,execute,verify,snapshot,replay) is invoked beforeruntime.start()or afterruntime.stop(). - Fix: Call
runtime.start()before invoking session operations.
- When: An operation violates the active runtime mode's approval policy (e.g., calling
execute()inreadonlyorforensicmode, or executing high-risk directives incimode withoutapproved: true). - Fix: Switch to
development/recoverymode viaruntime.setMode("development")or pass{ approved: true }after human review ofruntime.preview(sessionId, planId).
- When: A
MutationPlanexceeds the active mode'smaxDirectivesormaxFilesTouchedbudget. - Fix: Split the refactoring into smaller producer-before-consumer batches or pass a higher session budget to
beginSession({ budget }).
- When: A session violates an
RTG-001..008graph invariant (such asRTG-003callingplanRepairswithout a priorrecordAudit), or an invalid SHA-256 hash /../path traversal is passed toNodeCasStorage. - Fix: Follow the
Audit→MutationPlan→Execution→Verificationpipeline and pass only canonical 64-hex SHA-256 digests to CAS methods.
- When:
NodeCasStorage.readBlob(hash)detects that the physical file's SHA-256 digest does not match its content address. - Automatic Quarantine: The corrupted file is automatically moved to
.broccolidb/storage/corrupt/<hash>.<timestamp>.corruptand logged in.broccolidb/storage/corrupt/manifest.jsonl.
- When:
NodeCasStorage.hydrateContent("CAS:<sha256>")references a blob hash that does not exist on disk. - Fix: Re-write the payload via
writeBlob()orscaleContent()before hydrating.
Enforced by verifyRuntimeGraphIntegrity() in src/domain/broccoliRules.mjs:
| Code | Title | Invariant |
|---|---|---|
RTG-001 |
Orphaned Runtime Graph Node | Every node must belong to an active sessionId. |
RTG-002 |
Dangling Runtime Graph Edge | Every edge's from and to endpoints must exist in the session graph. |
RTG-003 |
Unproven Mutation Chain | Every MutationPlan requires a preceding Audit; every Execution requires a MutationPlan. |
RTG-004 |
Replay Hash Divergence | Rehydrated snapshot graphHash must match the expected live graphHash. |
RTG-005 |
Snapshot/CAS Blob Corruption | Backing CAS blob SHA-256 must match on snapshot load. |
RTG-006 |
Unlinked Rollback Node | Every Rollback node must link to its failed Execution via rolled_back_by. |
RTG-007 |
Unlinked Verification Node | Post-mutation Verification nodes must link to Execution via verified_by. |
RTG-008 |
Premature Session Completion | A session cannot be marked completed while open ERROR findings or failed gates remain. |
Run node bin/joy-check.mjs --explain <CODE> for full remediation examples on any code:
| Code | Default Severity | Title | SOP |
|---|---|---|---|
SPI-006 |
ERROR |
Disk Parity Reality Drift (Merkle Mismatch) | SOP: REFRESH_REALITY |
SPI-101 |
ADVISORY |
High Distance from Main Sequence ( |
SOP: EXTRACT_CONTRACT |
SPI-102 |
ADVISORY |
Phantom Symbol Import (Missing Named Export) | SOP: FIX_EXPORT_OR_IMPORT |
SPI-103 |
ADVISORY |
Deep Directory Nesting (> 4 Levels) |
SOP: FLATTEN_TREE |
SPI-104 |
ADVISORY |
Compile-Time Type Cycle (import type Loop) |
SOP: EXTRACT_INTERFACE |
SPI-105 |
ADVISORY |
High Logic Density in Non-Domain Layer (> 0.30) |
SOP: EXTRACT_DOMAIN |
SPI-106 |
ADVISORY |
Symbol Resonance (Cross-Zone Naming Collision) | SOP: RENAME_DISAMBIGUATE |
SPI-107 |
ADVISORY |
Implicit Interface (Missing I<ClassName>) |
SOP: SYNTHESIZE_INTERFACE |
SPI-108 |
ADVISORY |
Ghost Coupling (Jaccard Co-Mutation |
SOP: EXTRACT_CONTRACT |
SPI-109 |
ADVISORY |
Silent Clone (Duplicate Logic Across Modules) | SOP: EXTRACT |
SPI-110 |
ADVISORY |
Asymmetric Lifecycle (init without dispose) |
SOP: SYMMETRIC_LIFECYCLE |
SPI-111 |
ADVISORY |
Domain Drift (Pure Logic in INFRASTRUCTURE) |
SOP: EXTRACT_DOMAIN |
SPI-112 |
ADVISORY |
Unused Import Binding | SOP: CLEAN_IMPORTS |
SPI-201 |
ERROR |
Runtime Circular Dependency (A -> B -> A) |
SOP: DECOUPLE |
SPI-202 |
ADVISORY |
Systemic Risk (Node Blast Radius |
SOP: SPLIT_HUB |
SPI-203 |
ADVISORY |
Structural Load (Fat Module |
SOP: DECOMPOSE |
SPI-204 |
ADVISORY |
Orphaned Module ( |
SOP: PRUNE |
SPI-205 |
ERROR |
Mutable Plumbing State (let/var in PLUMBING) |
SOP: HEAL_STATELESSNESS |
SPI-206 |
ERROR |
Axiomatic Layer Leakage (Forbidden Cross-Zone Import) | SOP: INVERT_DEPENDENCY |
SPI-207 |
INFO |
Structural Bridge (Tarjan Articulation Point) | SOP: HARDEN_BRIDGE |
SPI-208 |
ERROR |
Geographic Misalignment (Missing/Mismatched [LAYER]) |
SOP: ALIGN_TAGS |
SPI-209 |
ERROR |
Import Depth Exceeded (> 3 ../ Traversals) |
SOP: FLATTEN_OR_ALIAS |
SPI-300 |
ADVISORY |
Ripple Prophecy Alert (Blast Radius |
SOP: TRIAD_AUDIT |
SPI-301 |
ADVISORY |
Vocabulary Drift (Zone Naming Mismatch) | SOP: RENAME_DISAMBIGUATE |
SPI-302 |
ADVISORY |
Refactoring Fatigue / Structural Fission Needed | SOP: DECOMPOSE |
SPI-303 |
ADVISORY |
Low Maintainability Index ( |
SOP: SIMPLIFY_CONTROL_FLOW |
SPI-401 |
ERROR |
Dynamic Code Execution (eval / new Function) |
SOP: ELIMINATE_EVAL |
SPI-402 |
ERROR |
Unsanitized DOM Assignment (innerHTML) |
SOP: SANITIZE_DOM |
SPI-403 |
ERROR |
Unverified dangerouslySetInnerHTML
|
SOP: SANITIZE_DOM |