phacility/phabricator · error · PhabricatorWorkerPermanentFailureException
Found unexpected job status ("%s").
Error message
Found unexpected job status ("%s"). What it means
PhabricatorWorkerBulkJobCreateWorker performs the queued setup step for a bulk job and requires the job to still be in STATUS_WAITING; any other status indicates a race (the job already advanced, was cancelled, or is being processed elsewhere) and the task is permanently failed rather than retried. This is Phabricator's guard against double-executing job setup and its side effects.
Source
Thrown at src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobCreateWorker.php:19
<?php
final class PhabricatorWorkerBulkJobCreateWorker
extends PhabricatorWorkerBulkJobWorker {
protected function doWork() {
$lock = $this->acquireJobLock();
$job = $this->loadJob();
$actor = $this->loadActor($job);
$status = $job->getStatus();
switch ($status) {
case PhabricatorWorkerBulkJob::STATUS_WAITING:
// This is what we expect. Other statuses indicate some kind of race
// is afoot.
break;
default:
throw new PhabricatorWorkerPermanentFailureException(
pht(
'Found unexpected job status ("%s").',
$status));
}
$tasks = $job->createTasks();
foreach ($tasks as $task) {
$task->save();
}
$this->updateJobStatus(
$job,
PhabricatorWorkerBulkJob::STATUS_RUNNING);
$lock->unlock();
foreach ($tasks as $task) {
PhabricatorWorker::scheduleTask(View on GitHub (pinned to 5720a38cfe)
Solutions
- Check the bulk job's current status in the UI or database; if it already progressed past WAITING, the failure is the guard working correctly and the duplicate task can be discarded.
- If the job is genuinely stuck and this was its only create task, re-run the job from the bulk job UI so a fresh create task is queued.
- Never hand-insert or duplicate worker tasks for bulk jobs.
Defensive patterns
Strategy: try-catch
Try / catch
try {
// execute the bulk job create worker
} catch (PhabricatorWorkerPermanentFailureException $ex) {
// terminal: mark the task garbage, inspect the job status, never blind-requeue
} Prevention
- Do not duplicate or hand-requeue bulk job worker tasks.
- Drive bulk jobs through their UI lifecycle (confirm/queue) only.
- Treat this failure on duplicate tasks as expected after queue duplication.
When it happens
Trigger: Two create-task workers racing on one bulk job (duplicate queue entry); the job being confirmed, cancelled or otherwise moved past WAITING between queueing and execution; manually re-queueing a job's create task after it already ran.
Common situations: Queue duplication after a database restore or manual worker-table edits; operators 'retrying' a stuck bulk job by cloning its tasks; heavy taskmaster load exposing races between duplicate tasks.
Related errors
- Found unexpected task status ("%s").
- Worker has no job ID.
- Worker has no task ID.
- Worker has invalid job ID ("%s").
- Worker has invalid task ID ("%s").
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/0bd6cff3a759f53f.
Report an issue: GitHub.