phacility/phabricator · error · Exception

Lease has unknown status "%s".

Error message

Lease has unknown status "%s".

What it means

Defensive default branch of the status switch in the `bin/drydock lease` wait loop: the lease's status constant matches none of ACTIVE, RELEASED, DESTROYED, BROKEN, PENDING, ACQUIRED. This should be impossible on a healthy install and indicates an unknown/newer DrydockLeaseStatus constant — e.g. schema or code version skew between the database state and the running code.

Source

Thrown at src/applications/drydock/management/DrydockManagementLeaseWorkflow.php:257

      }

      $status = $lease->getStatus();

      switch ($status) {
        case DrydockLeaseStatus::STATUS_ACTIVE:
          $is_active = true;
          break;
        case DrydockLeaseStatus::STATUS_RELEASED:
          throw new Exception(pht('Lease has already been released!'));
        case DrydockLeaseStatus::STATUS_DESTROYED:
          throw new Exception(pht('Lease has already been destroyed!'));
        case DrydockLeaseStatus::STATUS_BROKEN:
          throw new Exception(pht('Lease has been broken!'));
        case DrydockLeaseStatus::STATUS_PENDING:
        case DrydockLeaseStatus::STATUS_ACQUIRED:
          break;
        default:
          throw new Exception(
            pht(
              'Lease has unknown status "%s".',
              $status));
      }

      if ($is_active) {
        break;
      } else {
        sleep(1);
      }
    }
  }

  private function getBlueprintFilterMap(array $identifiers) {
    $viewer = $this->getViewer();

    $query = id(new DrydockBlueprintQuery())
      ->setViewer($viewer)

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Inspect the raw status value: `SELECT status FROM drydock_lease WHERE id = <id>;` and compare with the constants in src/applications/drydock/status/DrydockLeaseStatus.php.
  2. Complete the upgrade (or rollback) so the code defines every status present in the database, then re-run.
  3. Manually move or release orphaned leases from the unknown status if they are stuck test data.
Defensive patterns

Strategy: try-catch

Validate before calling

$known = array(
  DrydockLeaseStatus::STATUS_ACTIVE,
  DrydockLeaseStatus::STATUS_RELEASED,
  DrydockLeaseStatus::STATUS_DESTROYED,
  DrydockLeaseStatus::STATUS_BROKEN,
  DrydockLeaseStatus::STATUS_PENDING,
  DrydockLeaseStatus::STATUS_ACQUIRED,
);
if (!in_array($lease->getStatus(), $known, true)) {
  // version skew: do not loop, surface for manual inspection
}

Try / catch

try {
  $lease->waitUntilActive();
} catch (Exception $ex) {
  if (preg_match('/unknown status/', $ex->getMessage())) {
    // never retry: dump the raw status and halt for operator inspection
    fwrite(STDERR, 'Unknown lease status: '.$lease->getStatus());
    exit(1);
  }
  throw $ex;
}

Prevention

When it happens

Trigger: A lease row carries a status value not defined by the DrydockLeaseStatus class of the running code: half-completed upgrade, custom status injected by an extension, or code rollback after a newer version wrote new statuses.

Common situations: Upgrading Phabricator while leases are mid-flight; running mixed versions of code against one database; third-party extensions adding lease statuses without patching this switch.

Related errors


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