{"record":{"id":"2655330fa0c2781f","repo":"phacility/phabricator","slug":"unable-to-load-diff","errorCode":null,"errorMessage":"Unable to load diff.","messagePattern":"Unable to load diff\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/differential/controller/DifferentialInlineCommentEditController.php","lineNumber":90,"sourceCode":"    $inline = $this->loadCommentByID($id);\n    if (!$inline) {\n      throw new Exception(pht('Unable to load inline \"%d\".', $id));\n    }\n\n    $changeset = id(new DifferentialChangesetQuery())\n      ->setViewer($viewer)\n      ->withIDs(array($inline->getChangesetID()))\n      ->executeOne();\n    if (!$changeset) {\n      throw new Exception(pht('Unable to load changeset.'));\n    }\n\n    $diff = id(new DifferentialDiffQuery())\n      ->setViewer($viewer)\n      ->withIDs(array($changeset->getDiffID()))\n      ->executeOne();\n    if (!$diff) {\n      throw new Exception(pht('Unable to load diff.'));\n    }\n\n    $revision = id(new DifferentialRevisionQuery())\n      ->setViewer($viewer)\n      ->withIDs(array($diff->getRevisionID()))\n      ->executeOne();\n    if (!$revision) {\n      throw new Exception(pht('Unable to load revision.'));\n    }\n\n    $viewer_phid = $viewer->getPHID();\n    $is_owner = ($viewer_phid == $revision->getAuthorPHID());\n    $is_author = ($viewer_phid == $inline->getAuthorPHID());\n    $is_draft = ($inline->isDraft());\n\n    if ($is_owner) {\n      // You own the revision, so you can mark the comment as \"Done\".\n    } else if ($is_author && $is_draft) {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/controller/DifferentialInlineCommentEditController.php#L72-L108","documentation":"The diff referenced by the changeset must also load; a missing diff row throws 'Unable to load diff'. Like the changeset failure it signals broken referential integrity: the changeset exists but its parent diff is gone.","triggerScenarios":"A changeset row whose diff was deleted, so the chain inline -> changeset -> diff breaks at the diff hop.","commonSituations":"Manual database cleanup, partial imports or restores, or scripts that deleted diff rows directly.","solutions":["Repair or remove the orphaned changeset rows.","Restore the lost diff from a backup if it was removed by accident.","Have an admin run integrity checks after any direct database maintenance."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  // perform the inline comment action\n} catch (Exception $ex) {\n  if (preg_match('/Unable to load diff/', $ex->getMessage())) {\n    // orphaned changeset: surface to the admin for data repair\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Delete diffs only through the application, never with direct SQL.","Back up before database-level cleanup of differential tables.","Restore lost diffs from backups when detected."],"tags":["phabricator","differential","inline-comment","data-integrity"],"backgroundTag":"orphaned-reference","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}