Cloudflare Workflows automatically retry failed steps according to their configured retry policy. This is the right behaviour for transient failures — a downstream service being temporarily unavailable, a network timeout, or a brief resource exhaustion. However, some failures should never be retried: bad input data will not become valid input on the next attempt, and retrying it wastes quota and delays the workflow from failing fast. Sideffect providesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/eersnington/sideffect/llms.txt
Use this file to discover all available pages before exploring further.
NonRetryableError as a portable, explicit way to signal that a step or workflow should stop immediately without retrying.
NonRetryableError
NonRetryableError is a plain Error subclass exported from the sideffect package. Its name property is always "NonRetryableError", which is the signal Cloudflare uses to identify non-retryable failures.
run function, from a workflow’s run function, or from any code that runs inside either context.
Throwing NonRetryableError in a Step
NonRetryableError communicates this intent explicitly.
Automatic Schema Validation Errors
You do not always need to throwNonRetryableError manually. Sideffect automatically converts schema validation failures into non-retryable errors for both step payloads and step results.
Payload validation
Beforerun is called, Sideffect decodes the payload using the step’s payload schema. If decoding fails, a NonRetryableError is thrown with a message in this format:
Result validation
Afterrun returns, Sideffect decodes the result using the step’s result schema. If decoding fails, a NonRetryableError is thrown with the same structure:
Cloudflare Native Conversion
Sideffect’sNonRetryableError is a portable class that does not depend on Cloudflare’s runtime. However, Cloudflare’s Workflow runtime detects non-retryable failures by checking for its own NonRetryableError constructor. Sideffect’s generated WorkflowEntrypoint classes automatically convert Sideffect’s portable error to Cloudflare’s native NonRetryableError at the entrypoint boundary, so the Cloudflare dashboard and Cloudflare’s internal retry logic both see the correct error type.
You never need to import Cloudflare’s NonRetryableError yourself — Sideffect handles the conversion transparently.
When to Use NonRetryableError
Import Reference
NonRetryableError is a named export from the main sideffect package. No separate import path is needed.
Steps
Schema validation that auto-generates non-retryable errors.
Workflows
Compose steps into full workflow pipelines.
Rollback
Attach compensation handlers to steps with Rollback.with().
Step Context
Access env bindings, retry counts, and step metadata inside a step.