replay-timeout
Each time a run resumes, the runtime re-runs the workflow function against the recorded event log to rebuild its state. That replay has a time budget per handler invocation (WORKFLOW_REPLAY_TIMEOUT_MS). Time spent inside "use step" bodies doesn't count against it.
When replay exceeds the budget, the delivery is retried. After WORKFLOW_REPLAY_TIMEOUT_MAX_RETRIES attempts, the run is failed with the REPLAY_TIMEOUT error code.
Error message
Why it happens
- The event log is very large. On the default engine, replay time grows with the number of events in the run.
- The workflow function does heavy synchronous work outside of steps, such as parsing large payloads or tight loops.
How to fix it
Run on the QuickJS VM with snapshotting
The QuickJS engine is experimental, and its global surface differs from the default engine. Review the differences before switching an existing deployment.
Under QuickJS with snapshotting, a run restores its VM memory from a snapshot and replays only the events recorded since, so replay time stays roughly constant as the log grows. These runs are also exempt from the default per-run event limit.
Set WORKFLOW_VM=quickjs in the environment that starts runs. Snapshotting is on by default under QuickJS. Only runs started after the change use the new engine. See max-events-exceeded for the full eligibility rules.
Move heavy work into steps
Steps run with full Node.js access, their results are recorded once, and replay reuses those results without re-running the body. Move expensive parsing, transformation, and computation out of the workflow function into steps.
Raise the budget
As a short-term mitigation, raise WORKFLOW_REPLAY_TIMEOUT_MS. This doesn't reduce replay cost, which keeps growing with the log on the default engine.