{"record":{"id":"a750d2cdda30bff6","repo":"phacility/phabricator","slug":"no-s-in-task-data","errorCode":null,"errorMessage":"No \"%s\" in task data.","messagePattern":"No \"(.+?)\" in task data\\.","errorType":"exception","errorClass":"PhabricatorWorkerPermanentFailureException","httpStatus":null,"severity":"error","filePath":"src/applications/files/worker/FileDeletionWorker.php","lineNumber":8,"sourceCode":"<?php\n\nfinal class FileDeletionWorker extends PhabricatorWorker {\n\n  private function loadFile() {\n    $phid = idx($this->getTaskData(), 'objectPHID');\n    if (!$phid) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('No \"%s\" in task data.', 'objectPHID'));\n    }\n\n    $file = id(new PhabricatorFileQuery())\n      ->setViewer(PhabricatorUser::getOmnipotentUser())\n      ->withPHIDs(array($phid))\n      ->executeOne();\n\n    if (!$file) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('File \"%s\" does not exist.', $phid));\n    }\n\n    return $file;\n  }\n\n  protected function doWork() {\n    $file = $this->loadFile();","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/worker/FileDeletionWorker.php#L1-L26","documentation":"FileDeletionWorker (the PhabricatorWorker that actually removes file data from storage engines) requires 'objectPHID' in its task data; idx($this->getTaskData(), 'objectPHID') came back empty. It throws PhabricatorWorkerPermanentFailureException, which tells the queue the task can never succeed, so it is discarded rather than retried — the producer of the task passed malformed data.","triggerScenarios":"Queueing FileDeletionWorker with task data missing the key: PhabricatorWorker::scheduleTask('FileDeletionWorker', array(), ...) or with a typo'd key like 'filePHID'/'phid'; also code paths that build task data dynamically and silently drop the key.","commonSituations":"Custom scripts that schedule deletion workers directly instead of using PhabricatorFile::delete() (which sets objectPHID correctly); refactors renaming the task-data key; serialization bugs that empty the array.","solutions":["Queue the task with the required key: PhabricatorWorker::scheduleTask('FileDeletionWorker', array('objectPHID' => $file->getPHID()));","Prefer calling $file->delete() (or PhabricatorFileQuery + delete) and let it build correct task data for you.","Audit custom producers for the exact 'objectPHID' key; note tasks already failed permanently will not retry — re-queue them after fixing."],"exampleFix":"// before\nPhabricatorWorker::scheduleTask(\n  'FileDeletionWorker',\n  array('filePHID' => $file->getPHID()), // wrong key\n);\n\n// after\nPhabricatorWorker::scheduleTask(\n  'FileDeletionWorker',\n  array('objectPHID' => $file->getPHID()),\n);","handlingStrategy":"validation","validationCode":"$data = array('objectPHID' => $file->getPHID());\nif (idx($data, 'objectPHID') === null) {\n  throw new Exception('Refusing to queue FileDeletionWorker without objectPHID.');\n}\nPhabricatorWorker::scheduleTask('FileDeletionWorker', $data);","typeGuard":"function isValidDeletionTaskData(array $data): bool {\n  return idx($data, 'objectPHID') !== null;\n}","tryCatchPattern":null,"preventionTips":["Prefer $file->delete() over scheduling FileDeletionWorker by hand — it builds correct task data.","When scheduling workers directly, assert required task-data keys before scheduleTask().","Remember PhabricatorWorkerPermanentFailureException means no retry: fix the producer, then re-queue."],"tags":["phabricator","worker-queue","task-data","php"],"backgroundTag":"invalid-job-payload","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}