phacility/phabricator · error · Exception

Drydock lease PHID " " does not correspond to a valid lease.

Error message

Drydock lease PHID "%s" does not correspond to a valid lease.

What it means

Raised in HarbormasterDrydockLeaseArtifact::loadArtifactLease when the stored drydockLeasePHID property does not match any DrydockLease via DrydockLeaseQuery. The invalid input is the stale or wrong lease PHID in the artifact data.

Solutions

  1. Verify the lease PHID and that the lease still exists
  2. Check viewer permissions on the lease
  3. If the lease was already destroyed, clean up the stale artifact record
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/harbormaster/artifact/HarbormasterDrydockLeaseArtifact.php:46 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/461ab620060883ca. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/harbormaster/artifact/HarbormasterDrydockLeaseArtifact.php:46

    return $viewer->renderHandle($lease_phid);
  }

  public function willCreateArtifact(PhabricatorUser $actor) {
    // We don't load the lease here because it's expected that artifacts are
    // created before leases actually exist. This guarantees that the leases
    // will be cleaned up.
  }

  public function loadArtifactLease(PhabricatorUser $viewer) {
    $artifact = $this->getBuildArtifact();
    $lease_phid = $artifact->getProperty('drydockLeasePHID');

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

    return $lease;
  }

  public function releaseArtifact(PhabricatorUser $actor) {
    try {
      $lease = $this->loadArtifactLease($actor);
    } catch (Exception $ex) {
      // If we can't load the lease, treat it as already released. Artifacts
      // are generated before leases are queued, so it's possible to arrive
      // here under normal conditions.
      return;
    }

View on GitHub (pinned to 5720a38cfe)