Error Code Reference

Complete reference for all STL parser error codes (E001-E962) and warning codes (W001-W009).

Module: stl_parser.errors Import: from stl_parser.errors import ErrorCode, WarningCode, STLParseError, STLValidationError


Error Code Ranges

RangeCategoryException Class
E001-E011Parse errorsSTLParseError
E100-E115Validation errorsSTLValidationError
E200-E207Serialization errorsSTLSerializationError
E300-E304Graph errorsSTLGraphError
E400-E404File I/O errorsSTLFileError
E450-E453Query errorsSTLQueryError
E500-E502Builder errorsSTLBuilderError
E600-E603Schema errorsSTLSchemaError
E700-E702LLM errorsSTLLLMError
E800-E801Emitter errorsSTLEmitterError
E900-E901Decay errorsSTLDecayError
E950-E953Diff/Patch errorsSTLDiffError
E960-E962Reader errorsSTLReaderError
W001-W009WarningsSTLWarning

All exception classes inherit from STLError, which inherits from Exception.


Parse Errors (E001-E011)

Raised during lexing and parsing of STL text.

CodeMessageCauseFix
E001Unexpected tokenParser encountered a token it didn’t expectCheck syntax near the reported position
E002Invalid syntaxGeneral syntax errorVerify statement follows [A] -> [B] ::mod(...) pattern
E003Auto-extraction detected syntax errorsAuto-extraction mode found unparseable contentReview the input text for non-STL content
E004Unclosed bracket[Anchor without closing ]Add closing bracket: [Anchor]
E005Invalid arrow syntaxArrow is malformedUse -> or between anchors
E006Invalid modifier syntax::mod(...) block is malformedCheck parentheses, commas, and key=value pairs
E007Malformed namespaceNamespace syntax is invalidUse Namespace:Name or A.B:Name format
E008Invalid string valueString literal is malformedEnsure strings are properly quoted: "value"
E009Invalid number formatNumeric literal can’t be parsedUse standard number format: 0.85, 42
E010Invalid datetime formatDateTime doesn’t match ISO 8601Use "2025-01-15" or "2025-01-15T10:00:00Z"
E011Unexpected end of fileInput ends mid-statementComplete the statement or remove trailing arrow

Example:

from stl_parser import parse

try:
    result = parse('[Unclosed -> [B]')
except Exception as e:
    print(e)  # E004: Unclosed bracket

Validation Errors (E100-E115)

Raised during semantic validation of parsed statements.

CodeMessageCauseFix
E100Invalid anchor nameAnchor contains invalid charactersUse only letters, digits, underscores
E101Reserved name usedAnchor uses a reserved name (NULL, NONE, etc.)Choose a different name
E102Anchor name too longName exceeds 64 charactersShorten the anchor name
E103Invalid namespace formatNamespace contains invalid charactersUse letters, digits, underscores, dots
E104Invalid modifier keyModifier key is not a valid identifierUse alphanumeric keys with underscores
E105Invalid modifier value typeValue type doesn’t match expected typeCheck the modifier reference for correct types
E106Confidence value out of rangeconfidence or certainty is not in [0.0, 1.0]Use a value between 0.0 and 1.0
E107Invalid rule typerule value is not recognizedUse "causal", "logical", "empirical", "definitional", or "correlative"
E108Invalid anchor typeAnchor type is not one of the 9 canonical typesUse a valid AnchorType value
E109Invalid path typePath type is not recognizedUse a valid PathType value
E110Missing required modifierA required modifier is absentAdd the required modifier field
E111Conflicting modifiersTwo modifiers contradict each otherRemove one (e.g., time="Past" + tense="Future")
E112Invalid datetime formatModifier datetime value is malformedUse ISO 8601: "2025-01-15T10:00:00Z"
E113Semantic inconsistencyStatement is semantically inconsistentReview modifier combinations
E114Circular reference detectedStatement graph contains unexpected cycleBreak the cycle or mark as intentional
E115Dangling referenceAnchor referenced but never defined as source or targetConnect the anchor or remove the reference

Serialization Errors (E200-E207)

Raised during JSON/RDF/dict serialization and deserialization.

CodeMessageCauseFix
E200Serialization failedGeneral serialization errorCheck the ParseResult structure
E201Invalid JSON formatJSON string is malformedValidate the JSON syntax
E202Invalid JSON-LD formatJSON-LD structure is invalidCheck @context and @type fields
E203Invalid RDF formatRDF serialization failedVerify RDF format parameter ("turtle", "xml", "nt", "json-ld")
E204Deserialization failedCannot reconstruct ParseResult from dataEnsure the input matches the expected schema
E205Missing JSON-LD contextJSON-LD @context is missingAdd the required context object
E206Incompatible versionSerialized data version mismatchRe-serialize with current parser version
E207Encoding errorCharacter encoding issueEnsure UTF-8 encoding

Graph Errors (E300-E304)

Raised during graph construction and analysis.

CodeMessageCauseFix
E300Graph construction failedCannot build graph from ParseResultCheck that ParseResult contains valid statements
E301Invalid edgeEdge references a non-existent nodeEnsure both source and target anchors exist
E302Invalid nodeNode identifier is invalidCheck anchor name validity
E303Graph cycle detectedUnexpected cycle in graphReview the cycle; break it or handle intentionally
E304Disconnected graphGraph has isolated componentsConnect components or analyze separately

File I/O Errors (E400-E404)

Raised during file reading and writing operations.

CodeMessageCauseFix
E400File not foundSpecified file does not existCheck the file path
E401File read errorCannot read the fileCheck file permissions and encoding
E402File write errorCannot write to the fileCheck directory permissions and disk space
E403Permission deniedInsufficient file permissionsRun with appropriate permissions
E404Invalid file formatFile content is not valid STLCheck the file contains STL syntax

Query Errors (E450-E453)

Raised during query, filter, and pointer operations.

CodeMessageCauseFix
E450Invalid query operatorOperator not recognizedUse valid operators: __gt, __gte, __lt, __lte, __ne, __contains, __startswith, __in
E451Invalid pointer pathSTL pointer path is malformedUse format /index/field/subfield
E452Statement index out of rangePointer index exceeds statement countCheck the number of statements in the document
E453Query type errorValue type incompatible with operatorEnsure numeric operators are used with numeric fields

Builder Errors (E500-E502)

Raised by the programmatic builder API.

CodeMessageCauseFix
E500Builder validation errorBuilt statement fails validationCheck anchor names and modifier values
E501Builder configuration errorBuilder is misconfiguredEnsure source and target are set before .build()
E502Builder type errorIncorrect type passed to builderUse correct types for .mod() parameters

Schema Errors (E600-E603)

Raised during schema loading and validation.

CodeMessageCauseFix
E600Schema parse errorCannot parse .stl.schema fileCheck schema syntax
E601Schema validation errorDocument fails schema validationFix statements to conform to schema constraints
E602Schema not foundSchema file does not existCheck the schema file path
E603Schema conflictSchema rules conflict with each otherReview and fix conflicting schema rules

LLM Errors (E700-E702)

Raised during LLM output cleaning and repair.

CodeMessageCauseFix
E700LLM clean errorCannot clean the input textCheck that input contains STL-like content
E701LLM repair errorRepair operation failedReview the repair actions and input
E702LLM validation errorCleaned output fails validationApply additional manual fixes

Emitter Errors (E800-E801)

Raised by the STLEmitter during streaming output.

CodeMessageCauseFix
E800Emitter write errorCannot write to output file/streamCheck file permissions and path
E801Emitter format errorStatement cannot be formatted for outputCheck the statement structure

Decay Errors (E900-E901)

Raised during confidence decay calculations.

CodeMessageCauseFix
E900Invalid decay configurationhalf_life_days is <= 0Use a positive number for half-life
E901Decay calculation errorCannot compute effective confidenceCheck that statement has confidence and timestamp modifiers

Diff/Patch Errors (E950-E953)

Raised during document comparison and patching.

CodeMessageCauseFix
E950Diff type errorCannot compare the given inputsEnsure both inputs are valid ParseResult objects
E951Patch statement not foundPatch references a statement that doesn’t exist in the targetVerify the patch matches the target document
E952Patch conflictPatch operation conflicts with current stateResolve the conflict manually
E953Invalid patch operationPatch operation type is not recognizedUse valid operations from stl_diff() output

Reader Errors (E960-E962)

Raised during streaming input parsing.

CodeMessageCauseFix
E960Reader source errorCannot read from the input sourceCheck file path or stream validity
E961Reader parse errorCannot parse a line from the streamCheck STL syntax in the input stream
E962Multi-line continuation overflowMulti-line statement exceeds buffer limitBreak the statement into smaller parts

Warning Codes (W001-W009)

Warnings are non-fatal. They appear in ParseResult.warnings but do not prevent parsing.

CodeMessageCauseRecommendation
W001Deprecated syntaxUsing an outdated syntax formUpdate to current syntax
W002Unusual anchor nameAnchor name doesn’t follow conventionsReview naming; consider PascalCase or underscore_case
W003Low confidence valueconfidence < 0.3Verify the claim or rephrase
W004Missing recommended modifierStatement lacks commonly expected modifiersAdd source, confidence, or time as appropriate
W005Inconsistent styleMixed naming or formatting stylesStandardize style across the document
W006Duplicate statementSame statement appears more than onceRemove the duplicate
W007Unused anchorAnchor appears only once (no connections)Connect it to the graph or remove it
W008Complex namespace hierarchyNamespace has 3+ levels of dotsSimplify to 1-2 levels
W009Performance warningDocument is very large or complexConsider splitting into multiple files

Handling Errors in Code

from stl_parser import parse
from stl_parser.errors import STLParseError, STLValidationError, ErrorCode

try:
    result = parse('[Invalid!] -> [B]')
except STLParseError as e:
    print(f"Parse error: {e}")
except STLValidationError as e:
    print(f"Validation error: {e}")

# Check warnings after successful parse
result = parse('[A] -> [B]')
for warning in result.warnings:
    print(f"Warning {warning.code}: {warning.message}")

Error Class Hierarchy

Exception
└── STLError (base for all STL errors)
    ├── STLParseError        (E001-E011)
    ├── STLValidationError   (E100-E115)
    ├── STLSerializationError (E200-E207)
    ├── STLGraphError        (E300-E304)
    ├── STLFileError         (E400-E404)
    ├── STLQueryError        (E450-E453)
    ├── STLBuilderError      (E500-E502)
    ├── STLSchemaError       (E600-E603)
    ├── STLLLMError          (E700-E702)
    ├── STLEmitterError      (E800-E801)
    ├── STLDecayError        (E900-E901)
    ├── STLDiffError         (E950-E953)
    └── STLReaderError       (E960-E962)

STLWarning (W001-W009)  — not an exception, stored in ParseResult.warnings