{"record":{"id":"5b1ba0fb0ec1768b","repo":"phacility/phabricator","slug":"worker-has-invalid-task-id-s","errorCode":null,"errorMessage":"Worker has invalid task ID (\"%s\").","messagePattern":"Worker has invalid task ID \\(\"(.+?)\"\\)\\.","errorType":"exception","errorClass":"PhabricatorWorkerPermanentFailureException","httpStatus":null,"severity":"error","filePath":"src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php","lineNumber":53,"sourceCode":"\n  final protected function loadJob() {\n    $id = $this->getJobID();\n    $job = id(new PhabricatorWorkerBulkJobQuery())\n      ->setViewer(PhabricatorUser::getOmnipotentUser())\n      ->withIDs(array($id))\n      ->executeOne();\n    if (!$job) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('Worker has invalid job ID (\"%s\").', $id));\n    }\n    return $job;\n  }\n\n  final protected function loadTask() {\n    $id = $this->getTaskID();\n    $task = id(new PhabricatorWorkerBulkTask())->load($id);\n    if (!$task) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('Worker has invalid task ID (\"%s\").', $id));\n    }\n    return $task;\n  }\n\n  final protected function loadActor(PhabricatorWorkerBulkJob $job) {\n    $actor_phid = $job->getAuthorPHID();\n    $actor = id(new PhabricatorPeopleQuery())\n      ->setViewer(PhabricatorUser::getOmnipotentUser())\n      ->withPHIDs(array($actor_phid))\n      ->executeOne();\n    if (!$actor) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('Worker has invalid actor PHID (\"%s\").', $actor_phid));\n    }\n\n    $can_edit = PhabricatorPolicyFilter::hasCapability(\n      $actor,","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php#L35-L71","documentation":"loadTask() loads the PhabricatorWorkerBulkTask row by the taskID from worker task data; a failed load (no row with that ID) permanently fails the worker task. It is the task-level counterpart of the invalid-job-ID error and likewise indicates the referenced row is gone or the ID is wrong.","triggerScenarios":"The bulk task row was deleted before the worker ran; a partial database restore kept the worker task but dropped the bulk task rows; taskID corrupted in the worker task data.","commonSituations":"Cleanup scripts removing bulk task rows while worker tasks remain queued; restores from backup; manual worker-table surgery.","solutions":["Verify the bulk task row exists (phabricator_worker_bulk_task table) for the ID in the message.","If the surrounding job is still alive, re-queue its work through the bulk job UI rather than re-inserting rows by hand.","If the job was abandoned, dispose of the failed worker task — the permanent failure is expected."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$bulk_task = id(new PhabricatorWorkerBulkTask())->load($task_id);\nif (!$bulk_task) {\n  // do not queue or retry the task worker\n}","typeGuard":null,"tryCatchPattern":"try {\n  // run the bulk task worker\n} catch (PhabricatorWorkerPermanentFailureException $ex) {\n  // expected when the bulk task row is gone: log and archive\n}","preventionTips":["Do not delete bulk task rows while their worker tasks remain queued.","Clean up worker tasks and bulk task rows together.","Investigate partial restores when this appears in batches."],"tags":["phabricator","bulk-jobs","worker-queue","data-integrity"],"backgroundTag":"entity-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}