{"record":{"id":"5e597f475f828b19","repo":"phacility/phabricator","slug":"select-which-leases-you-want-to-release-see-he","errorCode":null,"errorMessage":"Select which leases you want to release. See \"--help\" for guidance.","messagePattern":"Select which leases you want to release\\. See \"--help\" for guidance\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/drydock/management/DrydockManagementReleaseLeaseWorkflow.php","lineNumber":30,"sourceCode":"          array(\n            'name' => 'id',\n            'param' => 'id',\n            'repeat' => true,\n            'help' => pht('Lease ID to release.'),\n          ),\n          array(\n            'name' => 'all',\n            'help' => pht('Release all leases. Dangerous!'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $is_all = $args->getArg('all');\n    $ids = $args->getArg('id');\n\n    if (!$ids && !$is_all) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Select which leases you want to release. See \"--help\" for '.\n          'guidance.'));\n    }\n\n    $viewer = $this->getViewer();\n\n    $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();","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/management/DrydockManagementReleaseLeaseWorkflow.php#L12-L48","documentation":"Thrown by the `drydock release-lease` management workflow when the command is invoked with neither any `--id <n>` argument(s) nor the `--all` flag. It is a PhutilArgumentUsageException, meaning Phabricator considers it a user (CLI) usage error: it prints the message plus help text and exits non-zero without touching any data. The check exists because releasing leases is destructive, so the workflow refuses to guess scope.","triggerScenarios":"Running `./bin/drydock release-lease` with no arguments; passing only unrelated flags (e.g. `--keep-powerless`); typo'ing the flag name so `getArg('id')` and `getArg('all')` both come back empty/false.","commonSituations":"Operators cleaning up stuck Drydock leases after a Harbormaster build storm; automation scripts that assume a default scope; running the workflow expecting an interactive prompt that does not exist.","solutions":["Re-run with explicit lease IDs: `./bin/drydock release-lease --id 12 --id 34`","To release everything releaseable at once: `./bin/drydock release-lease --all`","Run `./bin/drydock release-lease --help` to confirm flag names and repeat behavior of `--id`","In automation, pre-flight the argument vector so the script fails before invoking the workflow with an empty selection"],"exampleFix":"// before\n$ ./bin/drydock release-lease\nUsage Exception: Select which leases you want to release. See \"--help\" for guidance.\n\n// after\n$ ./bin/drydock release-lease --id 101 --id 102\nReleased lease 101.\nReleased lease 102.","handlingStrategy":"validation","validationCode":"// Before invoking the workflow, verify scope is selected:\n$ids = $args->getArg('id');\n$is_all = $args->getArg('all');\nif (!$ids && !$is_all) {\n  // print friendly guidance instead of letting the workflow throw\n  throw new PhutilArgumentUsageException(pht(\n    'Pass --id <n> (repeatable) or --all.'));\n}","typeGuard":null,"tryCatchPattern":"catch (PhutilArgumentUsageException $ex) { print usage and exit with the CLI's help exit code; treat as retryable after correcting arguments }","preventionTips":["Always pass --id or --all in scripts; assert non-empty argument list before exec'ing ./bin/drydock","Wrap operator commands in a shell function that requires at least one lease selector","Document that release operations are destructive and scope must be explicit"],"tags":["drydock","phabricator","cli","usage-error","argument-validation"],"backgroundTag":"cli-missing-required-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}