Compiler ErrorsCore, Fields & Paths

Core, Fields & Paths

Structural DSL errors — malformed YAML, unrecognised rule constructs, undeclared or misused fields, and invalid field paths.

18 error codes in this section.

Core Structure

VERR_RULESET_YAML_INVALID

Causet DSL syntax error. The Causet DSL file could not be parsed due to a syntax violation — tab indentation, unclosed quotes, duplicate keys, or invalid constructs.

Impact: Compilation aborts immediately. No IR is produced.

✗ Won't compile
rules:
  create_order:
	  when:              # tab indentation — Causet DSL forbids tabs
      intent_type: PlaceOrder
✓ Fixed
rules:
  create_order:
    when:               # use spaces
      intent_type: PlaceOrder

VERR_RULESET_EMPTY

Empty or whitespace-only Causet DSL file. A required Causet DSL file is empty or contains only whitespace and comments.

Impact: The rule file produces no handlers; intents targeting this stream will silently fail.

✗ Won't compile
# app.causet
---
# TODO: add rules later
✓ Fixed
rules:
  create_order:
    when:
      intent_type: PlaceOrder
    ops:
      - op: set
        path: /status
        value: pending

VERR_MODE_UNKNOWN

Unrecognised execution mode. A rule specifies a mode that is not one of the valid execution modes: sync, async, or preflight.

Impact: Rule cannot be executed. Intents targeting it will fail at runtime.

✗ Won't compile
rules:
  place_order:
    mode: background   # invalid
    when:
      intent_type: PlaceOrder
✓ Fixed
rules:
  place_order:
    mode: async
    when:
      intent_type: PlaceOrder

VERR_OP_UNKNOWN

Unrecognised operation type. An op in a rule’s ops list is not one of the supported operations (set, add, sub, push, merge, remove, unset, emit, find, for_each, if, sort).

Impact: Rule execution fails for every event that triggers it.

✗ Won't compile
ops:
  - op: write        # not valid
    path: /status
    value: active
✓ Fixed
ops:
  - op: set
    path: /status
    value: active

VERR_MISSING_FIELD

Required field missing from definition. A required key (such as when, path, value, or type) is absent from a rule, event, or intent block.

Impact: The rule cannot execute; the intent or event fails.

✗ Won't compile
ops:
  - op: set          # 'path' is required but missing
    value: active
✓ Fixed
ops:
  - op: set
    path: /status
    value: active

VERR_DUPLICATE

Duplicate rule or field name. A rule, field, or event is defined more than once at the same scope level. The second definition silently overrides the first in most Causet DSL parsers.

Impact: Silent data loss — one of the duplicate definitions is dropped.

✗ Won't compile
rules:
  place_order:
    when: { intent_type: PlaceOrder }
  place_order:       # duplicate key
    when: { intent_type: PlaceOrder }
✓ Fixed
# Rename one of the rules to a unique key.

VERR_IR_OP_UNKNOWN

Unknown operation type in IR compilation. An unknown operation code was encountered during IR compilation, typically caused by a compiler version mismatch or a manually edited IR artifact.

Impact: IR is unusable; runtime refuses to load it.

✗ Won't compile
# Manually edited IR artifact with unsupported op type
✓ Fixed
# Recompile from source using the current compiler version.
# Never hand-edit IR artifacts.

Field Correctness

VERR_FIELD_NOT_DECLARED

Writing undeclared field. A rule writes to a field that is not declared in app.causet.

Impact: Runtime rejects the write or stores data in an untyped shadow field.

✗ Won't compile
ops:
  - op: set
    path: /loyalty_tier    # not in app.causet
    value: gold
✓ Fixed
# 1. Add to app.causet:
#    loyalty_tier: { type: string, owner: order_stream }
# 2. Then use it:
ops:
  - op: set
    path: /loyalty_tier
    value: gold

VERR_FIELD_SCOPE_MISMATCH

Writing field from wrong scope. A rule writes to a field of the wrong scope — e.g. a PROJECT-scoped field from an ENTITY rule.

Impact: Write is silently rejected; field retains its old value.

✗ Won't compile
# entity rule
ops:
  - op: set
    path: /project/global_counter   # project scope from entity rule
    value: 1
✓ Fixed
# Move the op to a rule with the matching (project) scope.

VERR_FIELD_OWNERSHIP_VIOLATION

Writing another stream’s field. A stream writes to a field declared as owned by a different stream.

Impact: Write is rejected; the target stream’s state is not updated.

✗ Won't compile
# orders_stream rule writes email — owned by users_stream
ops:
  - op: set
    path: /email
    value: "new@example.com"
✓ Fixed
# Send a cross-stream intent to ask the owning stream
# to update its own field.

VERR_IMMUTABLE_FIELD_WRITE

Writing immutable field. A rule attempts to write to a field marked immutable: true after its initial value was set.

Impact: Throws a runtime error; intent fails.

✗ Won't compile
# app.causet: order_id: { immutable: true }
ops:
  - op: set
    path: /order_id    # cannot be changed after creation
    value: "new-id"
✓ Fixed
# Remove the set op. Immutable fields are written once at creation only.

VERR_INVALID_DEFAULT_VALUE

Default value type mismatch. A field’s default value does not match its declared type.

Impact: Entity initialisation fails; new entities cannot be created.

✗ Won't compile
fields:
  retry_count:
    type: integer
    default: "none"   # string on integer field
✓ Fixed
fields:
  retry_count:
    type: integer
    default: 0

Path Correctness

VERR_PATH_INVALID

Invalid path format. A field path has an invalid format — missing leading slash, illegal characters, or mixed path styles.

Impact: Rule fails to execute.

✗ Won't compile
ops:
  - op: set
    path: status        # must start with /
    value: active
✓ Fixed
ops:
  - op: set
    path: /status
    value: active

VERR_INVALID_JSON_PATH

Invalid JSON path syntax. A JSON path uses dot notation instead of slash notation, or has malformed array access syntax.

Impact: Path fails to resolve; op is silently skipped or throws.

✗ Won't compile
ops:
  - op: set
    path: /items.0.status    # dot notation is invalid
✓ Fixed
ops:
  - op: set
    path: /items[0]/status

VERR_PATH_NOT_RESOLVABLE

Path can never exist. A path traverses through a scalar field as if it were an object.

Impact: Runtime throws a path-not-resolvable error for every event.

✗ Won't compile
# status is a plain string field
ops:
  - op: set
    path: /status/code   # can't traverse into a scalar
✓ Fixed
# Either redesign status as an object, or use a flat path:
ops:
  - op: set
    path: /status_code

VERR_PATH_SCOPE_MISMATCH

Path scope mismatch. A path references a scope the current rule cannot access (e.g. /project/… from an entity rule).

Impact: Path silently resolves to null or throws.

✗ Won't compile
# entity rule
ops:
  - op: set
    path: /project/stats/total    # project scope in entity rule
✓ Fixed
# Use a project-scoped rule, or store the value in entity scope.

VERR_ILLEGAL_ROOT_WRITE

Write to root path /. A rule uses op: set with path: /, attempting to replace the entire entity state at once.

Impact: Runtime rejects the operation; intent fails.

✗ Won't compile
ops:
  - op: set
    path: /           # cannot replace entire state
    value: {}
✓ Fixed
# Set individual fields explicitly.
ops:
  - op: set
    path: /status
    value: active

VERR_RESOURCE_REF

Resource reference not found. A rule expression references a $resources.X key that has no corresponding entry in app.causet.

Impact: Expression evaluates to null; field receives incorrect or null value.

✗ Won't compile
ops:
  - op: set
    path: /config
    value: "#{ $resources.payment_config }"   # not in app.causet
✓ Fixed
# Add the entry to app.causet:
# payment_config:
#   stripe_key: "sk_..."
# Then the reference will resolve correctly.