{"record":{"id":"b3e298b8cad1d4f6","repo":"phacility/phabricator","slug":"worker-has-invalid-actor-phid-s","errorCode":null,"errorMessage":"Worker has invalid actor PHID (\"%s\").","messagePattern":"Worker has invalid actor PHID \\(\"(.+?)\"\\)\\.","errorType":"exception","errorClass":"PhabricatorWorkerPermanentFailureException","httpStatus":null,"severity":"error","filePath":"src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php","lineNumber":66,"sourceCode":"\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,\n      $job,\n      PhabricatorPolicyCapability::CAN_EDIT);\n\n    if (!$can_edit) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('Job actor does not have permission to edit job.'));\n    }\n\n    // Allow the worker to fill user caches inline; bulk jobs occasionally\n    // need to access user preferences.\n    $actor->setAllowInlineCacheGeneration(true);\n\n    return $actor;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php#L48-L84","documentation":"loadActor() resolves the job's author PHID to a real user record via PhabricatorPeopleQuery with the omnipotent viewer; when no user matches, the task permanently fails. Bulk jobs execute with their author's authority, so a resolvable author is mandatory.","triggerScenarios":"The job's author user was deleted while the job was queued; the job's AuthorPHID was set to a non-user PHID (or malformed) by custom job-creation code.","commonSituations":"Offboarding scripts that delete users with bulk jobs still pending; long-queued jobs surviving account removal; custom importers creating jobs with bogus author PHIDs.","solutions":["Confirm the author user still exists in the People application or user table.","If the user was removed, cancel/delete the job — it can never run without its author.","Custom job-creation code must set AuthorPHID to a valid, durable user (ideally a bot/system account)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$actor = id(new PhabricatorPeopleQuery())\n  ->setViewer(PhabricatorUser::getOmnipotentUser())\n  ->withPHIDs(array($author_phid))\n  ->executeOne();\nif (!$actor) {\n  // skip queueing long-running bulk work for a vanished author\n}","typeGuard":null,"tryCatchPattern":"try {\n  // run the bulk worker\n} catch (PhabricatorWorkerPermanentFailureException $ex) {\n  // author gone: cancel the job instead of retrying\n}","preventionTips":["Cancel or complete pending bulk jobs before deleting user accounts.","Set AuthorPHID to a durable bot/system user for automated jobs."],"tags":["phabricator","bulk-jobs","worker-queue","users"],"backgroundTag":"entity-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}