Skip to content

Error Handling & Debugging

Specification > Engineering

This chapter defines how a module reports failures and how you investigate them: a structured error-code format with explicit severities, a grade derived from severity counts, a fixed priority ladder for resolving defects, and a variable-tracing discipline for understanding them. The error-code rules are conditional and apply where a module emits codes; the debugging discipline is always in force.


Where a module reports failures with codes, each code MUST follow a PREFIX-NUMBER format, where PREFIX is a short uppercase namespace for the emitting module and NUMBER is a stable numeric identifier.

AspectRule
FormatA code MUST match PREFIX-NUMBER (for example AUTH-101).
PrefixThe prefix MUST be a short, uppercase, module-scoped namespace.
NumberThe number MUST be stable once assigned; you MUST NOT reuse a retired number for a new meaning.
MessageEvery code MUST carry a human-readable message describing the condition.

Every emitted condition MUST declare exactly one severity:

SeverityMeaning
ERRORA failure that prevents the operation from completing correctly.
WARNINGA recoverable or degraded condition that does not stop the operation.
INFOAn informational notice with no adverse effect.

A run MAY be summarized with a single grade derived from its severity counts. When a grade is reported, it MUST be computed from the counts as follows:

GradeCondition
ANo ERROR and no WARNING.
BNo ERROR, one or more WARNING.
COne or more ERROR.

The grade MUST be derived deterministically from the counts; you MUST NOT assign a grade that contradicts the severities present.

When you resolve a defect, you MUST work the steps in order and MUST NOT skip ahead:

StepAction
1Reproduce the problem first; confirm the failure before changing anything.
2Research the cause; understand why it happens before proposing a fix.
3Never rush an architectural change; structural rewrites are not a first response.
4Changing the environment is the last resort, attempted only after the steps above.

You MUST NOT alter environment or configuration to mask a defect whose cause you have not yet established.

When you debug, you MUST make no assumptions about a value and instead follow each variable through every method it passes, step by step, from where it originates to where it is consumed. You MUST confirm a value’s actual state at each step rather than inferring it, because an unverified assumption can send a fix in the wrong direction.