phacility/phabricator · error · Exception

Invalid commit PHID " "!

Error message

Invalid commit PHID "%s"!

What it means

Lookup failure in DiffusionInlineCommentController::loadCommit: the commit PHID taken from the request's URI data does not resolve to any commit visible to the viewer (single-PHID DiffusionCommitQuery returned nothing). Inline comment operations require a valid commit container, so a malformed, nonexistent, or inaccessible PHID aborts the controller.

Solutions

  1. Verify the commit PHID in the URL is complete and not mangled (copy the link fresh from the commit page)
  2. Ensure the acting user can see the commit's repository
  3. If the commit was hidden or the link predates a re-import, navigate to the commit directly and retry the comment action
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/diffusion/controller/DiffusionInlineCommentController.php:27 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/695d694cb8648c0e. Report an issue: GitHub.

Appendix: source

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

  protected function newContainerObject() {
    return $this->loadCommit();
  }

  private function getCommitPHID() {
    return $this->getRequest()->getURIData('phid');
  }

  private function loadCommit() {
    $viewer = $this->getViewer();
    $commit_phid = $this->getCommitPHID();

    $commit = id(new DiffusionCommitQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($commit_phid))
      ->executeOne();
    if (!$commit) {
      throw new Exception(pht('Invalid commit PHID "%s"!', $commit_phid));
    }

    return $commit;
  }

  protected function createComment() {
    $commit = $this->loadCommit();

    // TODO: Write a real PathQuery object?
    $path_id = $this->getChangesetID();
    $path = queryfx_one(
      id(new PhabricatorRepository())->establishConnection('r'),
      'SELECT path FROM %T WHERE id = %d',
      PhabricatorRepository::TABLE_PATH,
      $path_id);
    if (!$path) {
      throw new Exception(pht('Invalid path ID!'));
    }

View on GitHub (pinned to 5720a38cfe)