Skip to content

fix: preserve job handler stack traces - #18061

Open
Fnine59 wants to merge 1 commit into
payloadcms:mainfrom
Fnine59:fix/payload-jobs-error-stack-18055
Open

Fnine59 wants to merge 1 commit into
payloadcms:mainfrom
Fnine59:fix/payload-jobs-error-stack-18055

Conversation

@Fnine59

@Fnine59 Fnine59 commented Aug 31, 2026

Copy link
Copy Markdown

What?

  • Preserve task and workflow handler errors as native causes.
  • Keep the original application stack on job errors that are logged or persisted.
  • Add focused unit coverage for configured tasks, function workflows, JSON workflows, and non-Error throws.

Why?

Jobs currently replace handler errors with TaskError or WorkflowError instances whose stacks begin inside Payload. This removes the application frames needed to debug failures.

How?

TaskError and WorkflowError now accept ErrorOptions, retain the cause, and reuse an Error cause stack. Every handler-wrapping call site supplies the caught value as the cause, while task message extraction safely handles non-Error throws. Existing task, workflow, and JSON-job retry routing remains unchanged.

Fixes #18055

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jobs wrap handler errors in TaskError / WorkflowError and drop the original stack trace

1 participant