{"record":{"id":"f90b0904c16a207b","repo":"phacility/phabricator","slug":"lease-s-does-not-exist","errorCode":null,"errorMessage":"Lease \"%s\" does not exist.","messagePattern":"Lease \"(.+?)\" does not exist\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/drydock/management/DrydockManagementReleaseLeaseWorkflow.php","lineNumber":56,"sourceCode":"    $statuses = $this->getReleaseableLeaseStatuses();\n\n    $query = id(new DrydockLeaseQuery())\n      ->setViewer($viewer)\n      ->withStatuses(mpull($statuses, 'getKey'));\n\n    if ($ids) {\n      $query->withIDs($ids);\n    }\n\n    $leases = $query->execute();\n\n    if ($ids) {\n      $id_map = mpull($leases, null, 'getID');\n\n      foreach ($ids as $id) {\n        $lease = idx($id_map, $id);\n        if (!$lease) {\n          throw new PhutilArgumentUsageException(\n            pht('Lease \"%s\" does not exist.', $id));\n        }\n      }\n\n      $leases = array_select_keys($id_map, $ids);\n    }\n\n    if (!$leases) {\n      echo tsprintf(\n        \"%s\\n\",\n        pht('No leases selected for release.'));\n\n      return 0;\n    }\n\n    $drydock_phid = id(new PhabricatorDrydockApplication())->getPHID();\n\n    PhabricatorWorker::setRunAllTasksInProcess(true);","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/management/DrydockManagementReleaseLeaseWorkflow.php#L38-L74","documentation":"Thrown by `drydock release-lease` when one of the requested `--id` values does not match any lease returned by the query. Importantly the query is pre-filtered to statuses whose status object reports `canRelease()` (see getReleaseableLeaseStatuses), so a lease that exists in the database but is in a non-releaseable status (for example already RELEASED) is invisible to the query and is reported as \"does not exist\" just like a nonexistent ID. This is a PhutilArgumentUsageException: nothing is released, not even the other valid IDs.","triggerScenarios":"Passing a typo'd or guessed lease ID; referencing a lease that was already released (its status no longer canRelease()); referencing a lease whose status is not releaseable (e.g. broken/destroyed states excluded by the filter); passing an ID visible only to a different viewer (the query runs with the script viewer's permissions).","commonSituations":"Re-running an old release command from shell history after the leases were already freed; copy/paste of lease IDs from a stale web UI or log; IDs taken from a different Drydock installation.","solutions":["List the actual releaseable leases to get valid IDs: `./bin/drydock lease --status active` (or query via DrydockLeaseSearchQuery/`drydock.lease.search`) and re-run with those IDs","If the lease exists but was already released, no action is needed — verify with the lease UI or query","Check for leading zeros / whitespace or shell quoting issues around the ID list","Run with `--all` if the intent is to release every releaseable lease regardless of ID"],"exampleFix":"// before\n$ ./bin/drydock release-lease --id 9999\nUsage Exception: Lease \"9999\" does not exist.\n\n// after\n$ ./bin/drydock lease --status active   # find real IDs\n$ ./bin/drydock release-lease --id 42","handlingStrategy":"validation","validationCode":"// Verify IDs exist AND are releaseable before running the workflow:\n$statuses = DrydockLeaseStatus::getAllStatuses();\n$releaseable = array();\nforeach ($statuses as $key => $status) {\n  if (DrydockLeaseStatus::newStatusObject($status)->canRelease()) {\n    $releaseable[] = $key;\n  }\n}\n$leases = id(new DrydockLeaseQuery())\n  ->setViewer($viewer)\n  ->withIDs($ids)\n  ->withStatuses($releaseable)\n  ->execute();\nif (count($leases) !== count($ids)) {\n  // report which IDs are missing/non-releaseable before invoking release\n}","typeGuard":null,"tryCatchPattern":"catch (PhutilArgumentUsageException $ex) { the message names the bad ID; diff it against the releaseable-lease query results and either drop it or use --all }","preventionTips":["Fetch candidate lease IDs from the live query/UI at run time instead of hardcoding","Remember the release workflow only sees statuses where canRelease() is true — an 'already released' lease looks identical to a nonexistent one","Check shell quoting when forwarding ID lists"],"tags":["drydock","phabricator","cli","not-found","lease","status-filter"],"backgroundTag":"entity-not-found-by-id","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}