serialization-failed
This error occurs when you try to pass non-serializable data between execution boundaries in your workflow. All data passed between workflow functions, step functions, and the workflow runtime must be serializable to persist in the event log.
Error message
This error can appear when:
- Serializing workflow arguments when calling
start() - Serializing workflow return values
- Serializing step arguments
- Serializing step return values
Where the error surfaces
Where you observe the failure depends on which boundary it crosses:
- Workflow arguments:
start()throws synchronously in your application code. - Step arguments and step return values: the step fails with the
SerializationError, exactly like a step whose body threw a fatal error: no retries (the failure is deterministic), and atry/catcharound the step call in your workflow code observes it. The step's recorded input shows[input unavailable: step argument serialization failed]when the arguments were the unserializable part. - Workflow return values: the workflow body has already returned, so nothing can catch it; the run fails.
Uncaught, the error propagates out of the workflow body and the run fails immediately with the error code USER_ERROR; it does not retry.
Why this happens
Workflows persist their state using an event log. Every value that crosses execution boundaries must be:
- Serialized to be stored in the event log
- Deserialized when the workflow resumes
Functions, class instances, symbols, and other non-serializable types cannot be properly reconstructed after serialization, which would break workflow replay.
Common causes
Passing functions
Solution: Pass data instead, then define the function logic in the step.
Class instances
Solution: Pass plain objects and reconstruct the class in the step.
Supported serializable types
Workflow SDK supports these types across execution boundaries:
Standard JSON types
string,number,boolean,null- Arrays of serializable values
- Plain objects with serializable values
To learn more about supported types, see the Serialization section.
Debugging serialization issues
To identify what's causing serialization to fail:
- Check the error stack trace: It often shows which property failed.
- Simplify your data: Temporarily pass smaller objects to isolate the issue.
- Use supported data types: See Serialization for details.