Skip to content

5.0.0-beta.5 Zod schema rejects RemoteRef-wrapped step inputs from production service #1977

@adamiBs

Description

@adamiBs

Environment

- SDK: workflow@5.0.0-beta.5 (published 2026-05-11)
- Worker (server-side, per error User-Agent): @workflow/world-vercel/5.0.0-beta.4
- Runtime: Node 24, Vercel Functions, fluid compute
- Framework: Next.js 16.2 (Turbopack, React Compiler)
- Region: fra1
- Date observed: 2026-05-13, ~04:00 UTC onward

Summary

Every call to start(myWorkflow, [...]) returns 500 from our API route. The Workflow service accepts the run (a wrun_* ID is allocated and steps fire), but the SDK throws a
WorkflowWorldError when validating the response to POST /v3/runs/{runId}/events. The service is now returning step inputs wrapped as { _type: 'RemoteRef', _ref: 'dbrf:...' }
(blob-storage refs), but the SDK's Zod schema requires run.input and step.input as non-optional concrete values.

Regression history

- workflow@4.2.4 (until 2026-05-12 evening UTC): worked.
- Service-side change rolled out overnight 2026-05-12 -> 13.
- workflow@4.2.4 after the change: errored on run.output / run.error / run.completedAt being undefined for in-flight runs.
- Upgraded to workflow@5.0.0-beta.5: now errors on run.input / step.input.

Full error (post-upgrade, beta.5)

    Error [WorkflowWorldError]: Schema validation failed for POST /v3/runs/wrun_01KRFVDK2PHG87MGD5XQ9WTKJK/events:
      run.input: Invalid input: expected nonoptional, received undefined
      step.input: Invalid input: expected nonoptional, received undefined
Response context:
Content-Type: application/cbor, 2816 bytes (CBOR), preview: {
      event: {
        runId: 'wrun_XXXX',
        eventId: 'evnt_XXXX',
        correlationId: 'step_XXXX',
        eventType: 'step_created',
        eventData: {
          stepName: 'step//./workflows/foo-bar.workflow//fooStep',
          input: {
            _type: 'RemoteRef',
            _ref: 'dbrf:team_XXXX:prj_XXXXX:production:wrun_XXX:...'

    [cause] ZodError:
    [
      { code: 'invalid_type', expected: 'nonoptional', path: ['run','input'],  message: 'Invalid input: expected nonoptional, received undefined' },
      { code: 'invalid_type', expected: 'nonoptional', path: ['step','input'], message: 'Invalid input: expected nonoptional, received undefined' }
    ]
Pre-upgrade (4.2.4) variant of the same class:
    run.output:      Invalid input: expected nonoptional, received undefined
    run.error:       Invalid input: expected nonoptional, received undefined
    run.completedAt: Invalid input: expected nonoptional, received undefined

Where it fires

- Surfaces as Queue callback error on POST /.well-known/workflow/v1/flow for every event the SDK tries to acknowledge.

Repro

1. Install workflow@^5.0.0-beta.5 in a Next.js 16 app on Vercel production.
2. Define a workflow with at least one 'use step' function that takes a non-trivial input (anything that the service decides to externalize as a blob ref — we see it on a few-KB
structured object).
3. Call start(workflow, [input]) from an API route.
4. Observe 500 + the error above; verify the run still exists via the Workflow Run viewer.

What I think the fix is

Either:
- (SDK) Loosen the events-response Zod schema: run.input / step.input / run.output / run.error / run.completedAt should all be .optional() or accept the RemoteRef discriminated union - the service legitimately omits them for in-flight runs and externalizes large payloads.
- (Service) Stop returning bare RemoteRef for input/output in events that hit pre-5.0 SDKs, or inline payloads under some threshold.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions