Errors
Every error extends RungsError and has a stable code. Branch on the class or the code, never on
the message, which may become more helpful over time.
| Class | Code | When |
|---|---|---|
FlowDefinitionError | FLOW_INVALID | Invalid flow definition |
FlowNotFoundError | FLOW_NOT_FOUND | No flow with this key (and version) for the tenant or globally (EC-56). Exposes flowKey, version?, tenantId? |
ConfigurationError | CONFIG_INVALID | createRungs was given unusable options (missing store, clock or ids, an invalid dispatchRetry duration, events: "discard" with onEvent), clock or ids returned unusable values, or dispatchPending was called without onEvent |
InvalidCommandError | COMMAND_INVALID | Malformed command input (e.g. empty IDs, non-JSON payload, override without a comment). The message names each problem |
FlowNotApplicableError | FLOW_NOT_APPLICABLE | Submit refused because every step was skipped and the flow uses onAllSkipped: "fail" (EC-39). Exposes flowKey, skippedStepIds |
RequestNotFoundError | REQUEST_NOT_FOUND | Unknown request |
NotAssignedError | NOT_ASSIGNED | Actor has no pending task on this request, or is not the requester for resubmit / withdraw |
InvalidTransitionError | INVALID_TRANSITION | e.g. approving a closed request |
ConflictError | VERSION_CONFLICT | expectedVersion mismatch or concurrent write (EC-15). Exposes requestId, expectedVersion, actualVersion |
ResolutionError | RESOLUTION_FAILED | A host callback (role lookup, named resolver, isActiveUser) threw or returned invalid data (EC-05). Usually transient: nothing changed, so the command can be retried. The original error is in cause; exposes stepId |
NoApproversError | NO_APPROVERS | Submit refused because a step has no approvers (onEmptyStep: "fail") or cannot reach its quorum (EC-02, EC-04, EC-43, EC-45). A configuration or data problem: retrying will not help. Exposes stepId, reason, removed |
ConditionError | CONDITION_INVALID | A gt/gte/lt/lte condition meets a missing field or a type mismatch (EC-40). Exposes field, op, expected, received |
Rungs checks workflow routing (is this actor assigned to a task?), not authentication or permissions. Your application signs people in and decides, for example, who is an administrator, before it calls a command.
ResolutionError is usually worth retrying: a callback failed and nothing changed.
NoApproversError is not: a step has nobody who can approve it until your data or the flow
changes.