phacility/phabricator · error · Exception

File PHID " " does not correspond to a valid file.

Error message

File PHID "%s" does not correspond to a valid file.

What it means

Lookup/permission guard in the file build artifact: the filePHID stored on the artifact resolves to no PhabricatorFile visible to the acting user. The check exists so builds can't be used to smuggle files the actor can't see.

Solutions

  1. Verify the file PHID is correct and the file exists
  2. Grant the acting user (or build system user) view permission on the file
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/harbormaster/artifact/HarbormasterFileArtifact.php:56 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/5eed11a4452601c6. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/harbormaster/artifact/HarbormasterFileArtifact.php:56

  }

  public function willCreateArtifact(PhabricatorUser $actor) {
    // NOTE: This is primarily making sure the actor has permission to view the
    // file. We don't want to let you run builds using files you don't have
    // permission to see, since this could let you violate permissions.
    $this->loadArtifactFile($actor);
  }

  public function loadArtifactFile(PhabricatorUser $viewer) {
    $artifact = $this->getBuildArtifact();
    $file_phid = $artifact->getProperty('filePHID');

    $file = id(new PhabricatorFileQuery())
      ->setViewer($viewer)
      ->withPHIDs(array($file_phid))
      ->executeOne();
    if (!$file) {
      throw new Exception(
        pht(
          'File PHID "%s" does not correspond to a valid file.',
          $file_phid));
    }

    return $file;
  }

}

View on GitHub (pinned to 5720a38cfe)