{"record":{"id":"6258f594685dd319","repo":"phacility/phabricator","slug":"lease-has-unknown-status-s","errorCode":null,"errorMessage":"Lease has unknown status \"%s\".","messagePattern":"Lease has unknown status \"(.+?)\"\\.","errorType":"console","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/management/DrydockManagementLeaseWorkflow.php","lineNumber":257,"sourceCode":"      }\n\n      $status = $lease->getStatus();\n\n      switch ($status) {\n        case DrydockLeaseStatus::STATUS_ACTIVE:\n          $is_active = true;\n          break;\n        case DrydockLeaseStatus::STATUS_RELEASED:\n          throw new Exception(pht('Lease has already been released!'));\n        case DrydockLeaseStatus::STATUS_DESTROYED:\n          throw new Exception(pht('Lease has already been destroyed!'));\n        case DrydockLeaseStatus::STATUS_BROKEN:\n          throw new Exception(pht('Lease has been broken!'));\n        case DrydockLeaseStatus::STATUS_PENDING:\n        case DrydockLeaseStatus::STATUS_ACQUIRED:\n          break;\n        default:\n          throw new Exception(\n            pht(\n              'Lease has unknown status \"%s\".',\n              $status));\n      }\n\n      if ($is_active) {\n        break;\n      } else {\n        sleep(1);\n      }\n    }\n  }\n\n  private function getBlueprintFilterMap(array $identifiers) {\n    $viewer = $this->getViewer();\n\n    $query = id(new DrydockBlueprintQuery())\n      ->setViewer($viewer)","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php#L239-L275","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Complete the upgrade (or rollback) so the code defines every status present in the database, then re-run.","Manually move or release orphaned leases from the unknown status if they are stuck test data."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"$known = array(\n  DrydockLeaseStatus::STATUS_ACTIVE,\n  DrydockLeaseStatus::STATUS_RELEASED,\n  DrydockLeaseStatus::STATUS_DESTROYED,\n  DrydockLeaseStatus::STATUS_BROKEN,\n  DrydockLeaseStatus::STATUS_PENDING,\n  DrydockLeaseStatus::STATUS_ACQUIRED,\n);\nif (!in_array($lease->getStatus(), $known, true)) {\n  // version skew: do not loop, surface for manual inspection\n}","typeGuard":null,"tryCatchPattern":"try {\n  $lease->waitUntilActive();\n} catch (Exception $ex) {\n  if (preg_match('/unknown status/', $ex->getMessage())) {\n    // never retry: dump the raw status and halt for operator inspection\n    fwrite(STDERR, 'Unknown lease status: '.$lease->getStatus());\n    exit(1);\n  }\n  throw $ex;\n}","preventionTips":["Finish upgrades end-to-end before creating or waiting on Drydock leases.","Never run mixed Phabricator versions against one database.","Treat this error as a bug/version-skew report, not an operational hiccup."],"tags":["drydock","phabricator","lease","status","version-skew","internal"],"backgroundTag":"invalid-resource-state","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}