{"record":{"id":"bcf4f6937bcdf1a8","repo":"phacility/phabricator","slug":"failed-to-reload-commit-s","errorCode":null,"errorMessage":"Failed to reload commit \"%s\".","messagePattern":"Failed to reload commit \"(.+?)\"\\.","errorType":"exception","errorClass":"PhabricatorWorkerPermanentFailureException","httpStatus":null,"severity":"error","filePath":"src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php","lineNumber":45,"sourceCode":"\n  private function publishCommit(\n    PhabricatorRepository $repository,\n    PhabricatorRepositoryCommit $commit) {\n    $viewer = PhabricatorUser::getOmnipotentUser();\n\n    $commit_phid = $commit->getPHID();\n\n    // Reload the commit to get the commit data, identities, and any\n    // outstanding audit requests.\n    $commit = id(new DiffusionCommitQuery())\n      ->setViewer($viewer)\n      ->withPHIDs(array($commit_phid))\n      ->needCommitData(true)\n      ->needIdentities(true)\n      ->needAuditRequests(true)\n      ->executeOne();\n    if (!$commit) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht(\n          'Failed to reload commit \"%s\".',\n          $commit_phid));\n    }\n\n    $publisher = $repository->newPublisher();\n    $should_publish = $publisher->shouldPublishCommit($commit);\n\n    if (!$should_publish) {\n      $hold_reasons = $publisher->getCommitHoldReasons($commit);\n    } else {\n      $hold_reasons = array();\n    }\n\n    $data = $commit->getCommitData();\n    if ($data->getCommitDetail('holdReasons') !== $hold_reasons) {\n      $data->setCommitDetail('holdReasons', $hold_reasons);\n      $data->save();","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php#L27-L63","documentation":"PhabricatorRepositoryCommitPublishWorker re-loads the commit with data, identities, and audit requests attached before publishing notifications (PhabricatorRepositoryCommitPublishWorker.php:36-51). The viewer is omnipotent, so a failed reload is not a policy problem - the commit row itself vanished between task queuing and execution, and the task permanently fails.","triggerScenarios":"The repository or commit rows were deleted while publish tasks were pending; a partial database restore removed commit rows but left the worker queue intact.","commonSituations":"Deleting repositories with pending publish tasks; database maintenance/restore operations that skip the worker queue.","solutions":["Verify the commit still exists (query repository_commit by PHID) and that its repository is intact","If the deletion was intentional, let the task expire - permanent failure is the designed outcome","If the rows were restored or recreated, re-run parsing/publishing for the commit so a fresh publish task is queued (bin/repository reparse)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before publishing, confirm the commit still loads with data attached.\n$reloaded = id(new DiffusionCommitQuery())\n  ->setViewer(PhabricatorUser::getOmnipotentUser())\n  ->withPHIDs(array($commit->getPHID()))\n  ->needCommitData(true)\n  ->executeOne();\nif (!$reloaded) {\n  // commit row vanished; drop the publish task\n}","typeGuard":null,"tryCatchPattern":"try {\n  $this->loadCommit($viewer, $repository);\n} catch (PhabricatorWorkerPermanentFailureException $ex) {\n  // Commit deleted mid-queue (usually repository removal): permanent\n  // failure is correct; archive the task and log for audit.\n  phlog($ex);\n}","preventionTips":["Delete or drain publish queues before removing repositories","After restores, verify pending tasks still reference existing rows","Treat permanent publish failures as audit events, not transient errors"],"tags":["phabricator","worker-queue","publish","missing-record","permanent-failure","php"],"backgroundTag":"missing-database-record","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}