phacility/phabricator · error · Exception

Unable to load revision.

Error message

Unable to load revision.

What it means

The final hop of the 'Done' flow loads the revision that owns the diff; failure throws 'Unable to load revision'. Either the diff is attached to a revision ID that no longer exists, or the revision became invisible to the acting user between the other loads and this one.

Solutions

  1. Repair the orphaned diff row or purge it.
  2. Check whether a view policy, not deletion, hides the revision from this specific user.
  3. Retry with an account that can see the revision to distinguish policy from data loss.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  // perform the inline comment action
} catch (Exception $ex) {
  if (preg_match('/Unable to load revision/', $ex->getMessage())) {
    // orphaned diff or policy change: check visibility first, then data repair
  } else {
    throw $ex;
  }
}

Prevention

When it happens

Trigger: A diff row whose revision_id points at a deleted revision; a view-policy change that hides the revision from the user mid-flow.

Common situations: Revisions deleted while their diffs remained; policy restrictions applied to a project after users had already loaded inline comment pages.

Related errors


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

Appendix: source

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

      ->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) {
      // You made this comment and it's still a draft, so you can mark
      // it as "Done".
    } else {
      throw new Exception(
        pht(
          'You are not the revision owner, and this is not a draft comment '.
          'you authored.'));
    }

View on GitHub (pinned to 5720a38cfe)