phacility/phabricator · error · Exception

Failed to load commit.

Error message

Failed to load commit.

What it means

A lookup-failure guard in loadCommentForDone: after an inline comment was found, DiffusionCommitQuery could not load the commit identified by the comment's stored commit PHID. It indicates the commit record was destroyed, is in an inaccessible repository, or the PHID is stale/invalid.

Solutions

  1. Verify the commit still exists in Phabricator (it may have been destroyed or the repository re-imported)
  2. Check repository policies grant the viewer access to the commit
  3. If the commit was rewritten/imported under a new PHID, discard the stale inline comment
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/diffusion/controller/DiffusionInlineCommentController.php:65 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/applications/diffusion/controller/DiffusionInlineCommentController.php:65

    return id(new PhabricatorAuditInlineComment())
      ->setCommitPHID($commit->getPHID())
      ->setPathID($path_id);
  }

  protected function loadCommentForDone($id) {
    $viewer = $this->getViewer();

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

    $commit = id(new DiffusionCommitQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($inline->getCommitPHID()))
      ->executeOne();
    if (!$commit) {
      throw new Exception(pht('Failed to load commit.'));
    }

    $owner_phid = $commit->getAuthorPHID();
    $viewer_phid = $viewer->getPHID();
    $viewer_is_owner = ($owner_phid && ($owner_phid == $viewer_phid));
    $viewer_is_author = ($viewer_phid == $inline->getAuthorPHID());
    $is_draft = $inline->isDraft();

    if ($viewer_is_owner) {
      // You can mark inlines on your own commits as "Done".
    } else if ($viewer_is_author && $is_draft) {
      // You can mark your own unsubmitted inlines as "Done".
    } else {
      throw new Exception(
        pht(
          'You can not mark this comment as complete: you did not author '.
          'the commit and the comment is not a draft you wrote.'));
    }

View on GitHub (pinned to 5720a38cfe)