Skip to content

Programmatically Triggered Workflows Do Not Retry on Failure #11354

Open
@amrsaud

Description

@amrsaud

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions