Operations & Arrays
Errors from the ops: list inside a rule — wrong operation for a field’s type, and array-specific type checks.
21 error codes in this section.
Operation Correctness
VERR_SET_TYPE_MISMATCH
SET value type mismatch. The value in a set op does not match the declared field type.
Impact: Value coercion at runtime may store wrong data or fail silently.
# retry_count is type: integer
ops:
- op: set
path: /retry_count
value: "three" # string, not integerops:
- op: set
path: /retry_count
value: 3VERR_PUSH_TARGET_NOT_ARRAY
PUSH target is not an array. A push op targets a scalar field (string, integer, etc.) instead of an array field.
Impact: Runtime throws; intent fails entirely.
# status is type: string
ops:
- op: push
path: /status
value: active# Declare status as type: array, or use op: set for scalars.VERR_MERGE_TARGET_NOT_OBJECT
MERGE target is not an object. A merge op targets a non-object field (e.g. an array or scalar).
Impact: Runtime throws; intent fails.
# tags is type: array
ops:
- op: merge
path: /tags
value: { label: "vip" }# Use op: push for arrays, op: merge only for object fields.VERR_PREFLIGHT_SIDE_EFFECT
Side-effect operation in preflight rule. A preflight rule contains a mutating operation (set, emit, push, etc.). Preflight rules are read-only assertion gates.
Impact: If allowed, side-effects would execute even when the intent is later rejected by a guard.
rules:
check_inventory:
mode: preflight
ops:
- op: set # side-effect in preflight
path: /last_checked_at
value: "#{ event.ts }"# Preflight rules may only contain if/raise assertions.
# Move mutations to mode: sync or mode: async rules.VERR_ARITHMETIC_TARGET_NOT_NUMERIC
Arithmetic on non-numeric field. An add or sub op targets a field that is not numeric.
Impact: Runtime throws a type error; intent fails.
# status is type: string
ops:
- op: add
path: /status
value: 1# Declare the field as type: integer or type: double before using add/sub.VERR_REMOVE_TARGET_INVALID
Invalid REMOVE target. A remove op references a path that does not exist or cannot be removed.
Impact: Runtime error; intent fails.
ops:
- op: remove
path: /nonexistent_field# Verify the path exists in the entity schema.
# Use op: unset to clear optional scalar fields.VERR_UNSET_REQUIRED_FIELD
UNSET on required field. A rule attempts to unset a field declared with required: true.
Impact: Entity would be left in an invalid state missing a required field.
# order_id is required: true
ops:
- op: unset
path: /order_id# Remove required: true from the field definition if it needs to be clearable,
# or remove the unset op if the field should always have a value.VERR_FIND_WHERE_NOT_BOOLEAN
FIND where clause is not boolean. The where expression in a find op does not evaluate to a boolean.
Impact: Incorrect matching — all items may match or none may match.
ops:
- op: find
path: /items
where: "#{ item.quantity }" # returns integerops:
- op: find
path: /items
where: "#{ item.quantity > 0 }"VERR_FOREACH_NOT_ITERABLE
FOR_EACH on non-iterable field. A for_each op targets a scalar or object field instead of an array.
Impact: Runtime throws; rule fails for every event.
ops:
- op: for_each
path: /status # string, not array# Use for_each only on type: array fields.VERR_IF_CONDITION_NOT_BOOLEAN
IF condition is not boolean. An if op’s condition expression returns a non-boolean value.
Impact: Condition is treated as truthy/falsy by the runtime with unpredictable results.
ops:
- op: if
condition: "#{ entity.status }" # string, not booleanops:
- op: if
condition: "#{ entity.status == 'active' }"VERR_SORT_TARGET_NOT_SORTABLE
SORT on unsortable field. A sort op’s by field is an object, array, or other non-orderable type.
Impact: Sort produces an undefined ordering at runtime.
ops:
- op: sort
path: /items
by: /metadata # object — not sortable# Sort by a primitive field: string, integer, double, or timestamp.Array Type Validation
VERR_SCHEMA_SHAPE_MISMATCH
Array field missing item schema. An array field declaration is missing item_type or item_fields when they are required.
Impact: Runtime cannot validate items pushed to the array; type safety is lost.
fields:
line_items:
type: array # missing item_type / item_fieldsfields:
line_items:
type: array
item_type: object
item_fields:
sku: { type: string }
quantity: { type: integer }VERR_ARRAY_EXPECTED
Array operation on non-array field. An array operation (push, for_each) targets a non-array field.
Impact: Runtime throws; intent fails.
# status is type: string
ops:
- op: push
path: /status
value: active# Declare the field as type: array, or use op: set for scalars.VERR_INVALID_ITEM_TYPE
Array item type mismatch. An item pushed to an array does not match the declared item_type.
Impact: Item is stored with the wrong type; queries and aggregates produce incorrect results.
# line_items has item_type: object
ops:
- op: push
path: /line_items
value: "SKU-001" # string, not objectops:
- op: push
path: /line_items
value: { sku: "SKU-001", quantity: 1 }VERR_MISSING_ITEM_FIELD
Required array item field missing. An object pushed to an array is missing a field declared as required in item_fields.
Impact: Entity state has incomplete array items; queries against missing fields return null.
# item_fields: { sku: required, quantity: required }
ops:
- op: push
path: /line_items
value: { sku: "SKU-001" } # quantity missingops:
- op: push
path: /line_items
value: { sku: "SKU-001", quantity: 1 }VERR_INVALID_ITEM_FIELD_TYPE
Array item field type mismatch. An array item’s field value type does not match the item_fields schema.
Impact: Wrong type stored; aggregates and type-sensitive queries break silently.
# quantity is type: integer
value: { sku: "SKU-001", quantity: "three" }value: { sku: "SKU-001", quantity: 3 }VERR_INVALID_ARRAY_WRITE
Invalid write to array field. A write operation to an array field uses the wrong op or value type.
Impact: Write is rejected or corrupts the array.
# Attempting to set a scalar into an array field
ops:
- op: set
path: /tags
value: "single-tag"ops:
- op: set
path: /tags
value: ["single-tag"] # must be an arrayVERR_INVALID_ARRAY_READ
Invalid read from array field. An expression reads from an array field using a path pattern that treats it as a scalar.
Impact: Expression evaluates to the array object itself instead of an element.
# Treating /items as a scalar in an expression
value: "#{ entity.items }" # returns the whole array# Use find, for_each, or indexed access for array reads:
value: "#{ entity.items[0].sku }"VERR_INVALID_ELEMENT_PATH
Invalid array element path syntax. An element path uses dot notation for array indices instead of bracket notation.
Impact: Path fails to resolve; op is silently skipped.
ops:
- op: set
path: /items.sku # dot notation is invalid for arraysops:
- op: set
path: /items[]/skuVERR_INVALID_FOR_EACH
FOR_EACH on non-array. A for_each op targets a scalar or object field instead of an array field.
Impact: Runtime throws; rule fails.
ops:
- op: for_each
path: /status # string, not array# Declare the field as type: array, or use for_each only on array fields.VERR_REMOVE_REQUIRED_ARRAY
Removing required array field. A remove op targets an array field declared as required: true.
Impact: Entity left in an invalid state.
# tags is required: true
ops:
- op: remove
path: /tags# Set to an empty array instead of removing:
ops:
- op: set
path: /tags
value: []