payloadcms / payloadcms/payload

Programmatically Triggered Workflows Do Not Retry on Failure

Open
#11,354 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

invalid-reproduction stale status: needs-triage
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

Description:
When running workflows programmatically in payloadcms3, the workflow is executed only once regardless of its success or failure. This behavior leads to no automatic retries even in cases where the workflow fails. This lack of retry mechanism can cause significant issues in production environments where failures are not uncommon and retrying is critical to ensure task completion.

Steps to Reproduce:

  1. Trigger a workflow programmatically using the payloadcms3 API.
  2. Simulate a failure in the workflow (e.g., by introducing an error or returning a failure status).
  3. Observe that the workflow does not retry after the failure.

Expected Behavior:
The workflow should retry according to the configured retry logic or documented behavior, ensuring that transient failures do not lead to permanent task abandonment.

Actual Behavior:
The workflow is executed only once and does not retry regardless of whether it fails.

Link to the code that reproduces this issue

https://github.com/payloadcms/payload

Reproduction Steps

Steps to Reproduce:

  1. Trigger a workflow programmatically using the payloadcms3 API.
  2. Simulate a failure in the workflow (e.g., by introducing an error or returning a failure status).
  3. Observe that the workflow does not retry after the failure.
Which area(s) are affected? (Select all that apply)

area: core

Environment Info
Binaries:
  Node: 22.3.0
  npm: 10.8.3
  Yarn: N/A
  pnpm: 9.13.0
Relevant Packages:
  payload: 3.22.0
  next: 15.1.1
  @payloadcms/db-mongodb: 3.22.0
  @payloadcms/db-postgres: 3.22.0
  @payloadcms/email-nodemailer: 3.22.0
  @payloadcms/graphql: 3.22.0
  @payloadcms/next/utilities: 3.22.0
  @payloadcms/payload-cloud: 3.22.0
  @payloadcms/richtext-lexical: 3.22.0
  @payloadcms/translations: 3.22.0
  @payloadcms/ui/shared: 3.22.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the programmatic workflow API in the Payload repository and follow the execution path for failures and configured retries. Reproduce the failure described in the issue, then verify that a failed workflow is retried according to the configured or documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.