Skip to content

Error Codes

The stato compiler produces three severity levels of diagnostics. Hard errors (E-codes) block writes. Auto-corrections (W-codes) fix common issues silently. Advice (I-codes) suggest improvements.

Hard Errors (E001-E010)

These block the module from being written to disk.

CodePassMessageCause
E0011 (Syntax)Syntax error: {details}Python source has invalid syntax. Fix the syntax error and retry.
E0022 (Structure)No class definition foundThe file has no Python class. Every stato module must contain exactly one class.
E0034 (Schema)Missing required field: '{field}'A required field is missing from the class. Check the module schema for required fields.
E0044 (Schema)Missing required method: '{method}()'A required method is missing. Skill modules require run().
E0056 (Execute)Runtime execution error: {error}The module raised an exception when executed in the sandbox.
E0066 (Execute)Required method '{method}()' is not callableThe required method exists but is not callable (e.g., assigned as a string instead of defined as a function).
E0075 (Type Check)Field '{field}' expects {expected}, got {actual}A field has the wrong type and cannot be auto-corrected.
E0087 (Semantic)Duplicate step ID: {id} / depends_on references nonexistent stepPlan step IDs must be unique, and depends_on must reference existing step IDs.
E0097 (Semantic)Circular dependency in plan step DAGThe plan steps form a cycle. Reorder dependencies to form a valid DAG.
E0107 (Semantic)Invalid status '{status}'Plan step status must be one of: pending, running, complete, failed, blocked.

Auto-Corrections (W001-W006)

These are fixed automatically. The corrected source is written to disk. The original issue is logged as a warning.

CodePassMessageWhat It Fixes
W0015 (Type Check)depends_on is string, auto-wrapping in listdepends_on = "normalize" becomes depends_on = ["normalize"]
W0025 (Type Check)depends_on is int, auto-wrapping in listdepends_on = 1 becomes depends_on = [1]
W0035 (Type Check)Version missing patch numberversion = "1.0" becomes version = "1.0.0"
W0047 (Semantic)Missing status, auto-set to 'pending'Plan steps without a status field get status = "pending"
W0052 (Structure)Multiple classes found, using firstIf the file contains multiple classes, the first one is used. Others are ignored.
W0063 (Type Inference)Cannot confidently infer module typeThe class name and fields do not clearly indicate a module type. Defaults to skill. Consider renaming the class (e.g., end with State for memory, Context for context).

Advice (I001-I006)

These are informational suggestions. They do not block writes or trigger auto-corrections.

CodePassMessageSuggestion
I0013 (Type Inference)Class naming conventionMemory modules should end with State, context modules with Context, protocol modules with Protocol.
I0023 (Type Inference)No docstring on classAdd a docstring to describe what the module does.
I0037 (Semantic)No lessons_learned on skillSkills benefit from a lessons_learned field capturing hard-won insights.
I0047 (Semantic)No decision_log on planPlans benefit from a decision_log field documenting key architectural choices.
I0067 (Semantic)run() has no type hintsAdding type hints to run() improves readability and tooling support.

Compiler Passes

For reference, the 7 passes in order:

PassNameWhat It Checks
1Syntaxast.parse succeeds
2StructureExactly one class found
3Type InferenceDetermine module type from class name, fields, methods
4Schema CheckRequired fields and methods present
5Type CheckField types match schema, apply auto-corrections
6ExecuteRun in sandbox, verify methods callable
7SemanticModule-specific rules (plan DAG, step statuses, etc.)

Passes run in order. If a pass produces a hard error, subsequent passes may be skipped.

Auto-Correction Mechanics

When the compiler applies auto-corrections (W001-W003), it modifies the source text in-place. To avoid offset drift when multiple corrections target different lines, corrections are applied in reverse line order (highest line number first). The corrected source is stored in ValidationResult.corrected_source and used as input for subsequent passes (Execute and Semantic).

This means a module with both depends_on = "foo" (line 5) and version = "1.0" (line 3) will have both issues fixed in a single validation pass, with the line-5 fix applied before the line-3 fix to preserve character offsets.

Plan Semantic Validation Details

Pass 7 performs module-specific semantic checks. For plan modules, the compiler enforces four constraints:

  1. Step ID uniqueness (E008): every step dict in the steps list must have a unique id value. Duplicates are flagged immediately.

  2. Dependency reference validity (E008): every value in a step’s depends_on list must reference an id that exists in another step. References to nonexistent steps are flagged with the specific step ID and missing dependency.

  3. Status value validation (E010): the status field of each step must be one of five allowed values: pending, running, complete, failed, blocked. If a step has no status field at all, auto-correction W004 sets it to pending.

  4. DAG acyclicity (E009): the compiler builds a directed graph from step dependencies and checks for cycles using DFS with three-color marking (white = unvisited, gray = in current path, black = fully explored). A gray-to-gray edge indicates a cycle, which is reported with the full cycle path.