{"record":{"id":"dec79293ef059f34","repo":"phacility/phabricator","slug":"task-data-has-no-commitphid","errorCode":null,"errorMessage":"Task data has no \"commitPHID\".","messagePattern":"Task data has no \"commitPHID\"\\.","errorType":"exception","errorClass":"PhabricatorWorkerPermanentFailureException","httpStatus":null,"severity":"error","filePath":"src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php","lineNumber":38,"sourceCode":"    $commit_phid = idx($task_data, 'commitPHID');\n\n    // TODO: See T13591. This supports execution of legacy tasks and can\n    // eventually be removed. Newer tasks use \"commitPHID\" instead of\n    // \"commitID\".\n    if (!$commit_phid) {\n      $commit_id = idx($task_data, 'commitID');\n      if ($commit_id) {\n        $legacy_commit = id(clone $commit_query)\n          ->withIDs(array($commit_id))\n          ->executeOne();\n        if ($legacy_commit) {\n          $commit_phid = $legacy_commit->getPHID();\n        }\n      }\n    }\n\n    if (!$commit_phid) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('Task data has no \"commitPHID\".'));\n    }\n\n    $commit = id(clone $commit_query)\n      ->withPHIDs(array($commit_phid))\n      ->executeOne();\n    if (!$commit) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('Commit \"%s\" does not exist.', $commit_phid));\n    }\n\n    if ($commit->isUnreachable()) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht(\n          'Commit \"%s\" (with PHID \"%s\") is no longer reachable from any '.\n          'branch, tag, or ref in this repository, so it will not be '.\n          'imported. This usually means that the branch the commit was on '.\n          'was deleted or overwritten.',","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php#L20-L56","documentation":"PhabricatorRepositoryCommitParserWorker::loadCommit() reads the worker task payload: modern tasks carry 'commitPHID', and a legacy fallback (T13591) resolves 'commitID' to a PHID (PhabricatorRepositoryCommitParserWorker.php:20-40). If neither key yields a PHID, the task is permanently failed because the payload can never succeed.","triggerScenarios":"Scheduling PhabricatorRepositoryCommitParserWorker (or its change/message parser subclasses) with task data containing neither 'commitPHID' nor a resolvable 'commitID'; draining ancient pre-migration tasks whose commitID rows no longer exist.","commonSituations":"Custom scripts or extensions enqueueing parser tasks with wrong payload keys; long-lived task queues surviving Phabricator upgrades; manually re-queued archived tasks whose data was stripped or edited.","solutions":["Inspect the failed task payload in the worker logs to see which keys it actually carries","Re-queue with correct data: array('commitPHID' => $commit->getPHID()), or use bin/repository reparse which constructs tasks correctly","If a legacy commitID cannot resolve because the commit row is gone, let the task expire - permanent failure is the intended outcome"],"exampleFix":"// before\nPhabricatorWorker::scheduleTask(\n  'PhabricatorRepositoryCommitParserWorker',\n  array('commit' => $commit_identifier));\n\n// after\nPhabricatorWorker::scheduleTask(\n  'PhabricatorRepositoryCommitParserWorker',\n  array('commitPHID' => $commit->getPHID()));","handlingStrategy":"validation","validationCode":"// Validate payload shape before scheduling a parser task.\n$task_data = array('commitPHID' => $commit->getPHID());\nif (!idx($task_data, 'commitPHID') && !idx($task_data, 'commitID')) {\n  throw new Exception('Refusing to queue a parser task without commitPHID.');\n}\nPhabricatorWorker::scheduleTask(\n  'PhabricatorRepositoryCommitParserWorker',\n  $task_data);","typeGuard":"function hasValidParserPayload(array $task_data) {\n  return isset($task_data['commitPHID'])\n    || isset($task_data['commitID']);\n}","tryCatchPattern":"try {\n  $worker = new PhabricatorRepositoryCommitParserWorker($task_data);\n  $commit = $worker->loadCommit();\n} catch (PhabricatorWorkerPermanentFailureException $ex) {\n  // Malformed payload: log and drop; never retry - it cannot succeed.\n  phlog($ex);\n}","preventionTips":["Always queue parser tasks with array('commitPHID' => ...) - prefer bin/repository reparse","Do not hand-edit archived task data; the 'commitID' fallback exists only for legacy tasks","Add payload assertions in custom code that schedules repository workers"],"tags":["phabricator","worker-queue","task-payload","permanent-failure","php"],"backgroundTag":"worker-payload-validation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}