API Reference: Error Hierarchy & Exceptions (SigloError)
Siglo features a structured, strongly typed exception hierarchy rooted at SigloError. Every exception carries rich execution metadata—including the executing step name, lifecycle phase, retryability flag, execution stack ID, tenant namespace, state snapshots, and underlying error cause.
Table of Contents
- Exception Hierarchy Diagram
- Base Error:
SigloError - Timeout and Cancellation Exceptions
- Validation and Contract Exceptions
- Concurrency and Sagas Exceptions
- Network Guardrail Exceptions
- Durable and Event Exceptions
- Storage Exceptions
- Error Normalization
- Handling Errors in Workflows
Exception Hierarchy Diagram
Base Error: SigloError
All runtime errors thrown by Siglo extend SigloError.
Definition
Properties
stepName: Name of the step that was executing when the error occurred.phase: The lifecycle phase where failure occurred ('validation','before','action','after','checkpoint','retry', or'compensation').retryable: Boolean indicating whether the error is safe to retry under a retry policy.stackId: Execution stack UUID for correlating with logs and checkpoints.namespace: Multi-tenant partition namespace.cause: The underlying original error or exception.stateSnapshot: Context snapshot captured at the moment of failure.isTimeout: True if the error is aStepTimeoutExceptionorFlowTimeoutException.isCancellation: True if the error was triggered by anAbortSignal.
Timeout and Cancellation Exceptions
StepTimeoutException
Thrown when a step exceeds its configured step.timeout(ms) SLA deadline.
- Phase:
'action' - Retryable:
true
FlowTimeoutException
Thrown when the total execution time of the workflow exceeds flow.timeout(ms) or options.timeout.
- Phase:
'action' - Retryable:
false
CancellationException
Thrown when execution is aborted via an AbortSignal.
- Retryable:
false
Validation and Contract Exceptions
ValidationException
Thrown when incoming parameters fail step.schema() or step.spec() validation contracts. (Note: step.strict() filters out undeclared fields rather than throwing ValidationException).
- Phase:
'validation' - Retryable:
false
GraphValidationException
Thrown by assertValidGraph() when a workflow AST contains cyclical dependencies, invalid branching configurations, or unreachable nodes.
Concurrency and Sagas Exceptions
CompensationException
Thrown when a workflow step fails, triggering saga compensation rollbacks in reverse order, and either rollbacks complete or one or more compensations encounter errors.
originalError: The error that originally caused the workflow to fail.completedCompensations: List of step names whose compensations ran successfully.compensationErrors: Array of errors encountered during compensation rollbacks.
UnresolvableCompensationException
Thrown during saga compensation execution if a step’s registered compensation handler cannot be found in memory or the registry (e.g., after process restarts or workflow code drift).
- Phase:
'compensation' - Retryable:
false
FieldCollisionException
Thrown by parallel([...], { mergeStrategy: 'error' }) when two concurrent branches write conflicting values to the same context key.
IdempotencyConflictException
Thrown when an execution attempts to claim an idempotency key that is already marked IN_PROGRESS by another concurrent execution.
Network Guardrail Exceptions
NetworkPolicyViolationException
Thrown when a step’s pre-check, action, or post-check attempts an unauthorized network call violating the active allowNetwork() or networkPolicy() perimeter.
- Phase:
'before','action', or'after' - Retryable:
false
Durable and Event Exceptions
WorkflowSuspendedException
Thrown internally when a workflow encounters waitForEvent() or wait() in durable mode. Indicates that execution has been cleanly checkpointed to storage and execution should pause.
WorkflowVersionMismatchException
Thrown when resumeWorkflow() restores a checkpoint created under a code version different from the active workflow’s declared version, and no transformation was provided in options.migrations.
DuplicateEventException
Thrown when an event is delivered to resumeWorkflow() for a workflow instance that is not currently waiting or has already been resumed.
ExpiredWaitException
Thrown when attempting to resume a workflow whose waitForEvent timeout window or durable timer duration has already expired.
WorkflowAlreadyResumedException
Thrown when attempting to claim or resume a wait record that has already transitioned to completed status.
Storage Exceptions
StorageAdapterException
Thrown under setErrorMode('strict') when a storage adapter operation fails (e.g. database connection dropped).
CheckpointConflictException
Thrown when optimistic concurrency control detects a revision conflict during saveCheckpoint(). (Also exported as OptimisticLockException).
NamespaceMismatchException
Thrown when restoring a checkpoint into a mismatched tenant namespace.
CheckpointVersionException
Thrown when attempting to restore a checkpoint with an unsupported major schema version.
Error Normalization
normalizeError(error, metadata?)
Normalizes any thrown value (standard Error, string, object, or primitive) into a standard, typed SigloError.
