phacility/phabricator · error · Exception

Unable to load diff.

Error message

Unable to load diff.

What it means

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.

Source

Thrown at src/applications/differential/controller/DifferentialInlineCommentEditController.php:90

    $inline = $this->loadCommentByID($id);
    if (!$inline) {
      throw new Exception(pht('Unable to load inline "%d".', $id));
    }

    $changeset = id(new DifferentialChangesetQuery())
      ->setViewer($viewer)
      ->withIDs(array($inline->getChangesetID()))
      ->executeOne();
    if (!$changeset) {
      throw new Exception(pht('Unable to load changeset.'));
    }

    $diff = id(new DifferentialDiffQuery())
      ->setViewer($viewer)
      ->withIDs(array($changeset->getDiffID()))
      ->executeOne();
    if (!$diff) {
      throw new Exception(pht('Unable to load diff.'));
    }

    $revision = id(new DifferentialRevisionQuery())
      ->setViewer($viewer)
      ->withIDs(array($diff->getRevisionID()))
      ->executeOne();
    if (!$revision) {
      throw new Exception(pht('Unable to load revision.'));
    }

    $viewer_phid = $viewer->getPHID();
    $is_owner = ($viewer_phid == $revision->getAuthorPHID());
    $is_author = ($viewer_phid == $inline->getAuthorPHID());
    $is_draft = ($inline->isDraft());

    if ($is_owner) {
      // You own the revision, so you can mark the comment as "Done".
    } else if ($is_author && $is_draft) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Repair or remove the orphaned changeset rows.
  2. Restore the lost diff from a backup if it was removed by accident.
  3. Have an admin run integrity checks after any direct database maintenance.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  // perform the inline comment action
} catch (Exception $ex) {
  if (preg_match('/Unable to load diff/', $ex->getMessage())) {
    // orphaned changeset: surface to the admin for data repair
  } else {
    throw $ex;
  }
}

Prevention

When it happens

Trigger: A changeset row whose diff was deleted, so the chain inline -> changeset -> diff breaks at the diff hop.

Common situations: Manual database cleanup, partial imports or restores, or scripts that deleted diff rows directly.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/2655330fa0c2781f. Report an issue: GitHub.