Description
When retrying a failed job from a tab other than the "Failed" tab (e.g., viewing the job from the "Active" or "Latest" tab), the retry action fails with:
Error: Job <id> is not in the latest state. reprocessJob
The workaround is to navigate to the "Failed" tab and retry from there, which works correctly.
Root Cause
BullMQ's reprocessJob Lua script expects the job to exist in the state set matching the state parameter passed (e.g., failed or completed). It uses ZREM to remove the job from that set, and if the job isn't found there, it returns error code -3.
It appears that bull-board passes the expected state based on the current tab/view context rather than the job's actual state in Redis. When a failed job is viewed from a different tab, the wrong state is passed to reprocessJob, causing the error.
Expected Behavior
Either:
- The retry button should only be shown when the job is in a retriable state (failed/completed), or
- The retry action should pass the job's actual state rather than inferring it from the current tab/view
Environment
@bull-board/api: 6.16.4
@bull-board/express: 6.16.4
@taskforcesh/bullmq-pro: 7.39.3
bullmq: 5.58.7
Stack Trace
Error: Job 50878946 is not in the latest state. reprocessJob
at ScriptsPro.finishedErrors (/app/node_modules/.pnpm/bullmq@5.58.7/node_modules/bullmq/dist/cjs/classes/scripts.js:1108:24)
at ScriptsPro.finishedErrors (/app/node_modules/.pnpm/@taskforcesh+bullmq-pro@7.39.3/node_modules/@taskforcesh/bullmq-pro/dist/cjs/classes/scripts-pro.js:700:30)
at ScriptsPro.reprocessJob (/app/node_modules/.pnpm/@taskforcesh+bullmq-pro@7.39.3/node_modules/@taskforcesh/bullmq-pro/dist/cjs/classes/scripts-pro.js:233:28)
Description
When retrying a failed job from a tab other than the "Failed" tab (e.g., viewing the job from the "Active" or "Latest" tab), the retry action fails with:
The workaround is to navigate to the "Failed" tab and retry from there, which works correctly.
Root Cause
BullMQ's
reprocessJobLua script expects the job to exist in the state set matching thestateparameter passed (e.g.,failedorcompleted). It usesZREMto remove the job from that set, and if the job isn't found there, it returns error code-3.It appears that bull-board passes the expected state based on the current tab/view context rather than the job's actual state in Redis. When a failed job is viewed from a different tab, the wrong state is passed to
reprocessJob, causing the error.Expected Behavior
Either:
Environment
@bull-board/api: 6.16.4@bull-board/express: 6.16.4@taskforcesh/bullmq-pro: 7.39.3bullmq: 5.58.7Stack Trace