phacility/phabricator · warning · PhutilArgumentUsageException

Select which leases you want to release. See "--help" for gu

Error message

Select which leases you want to release. See "--help" for guidance.

What it means

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.

Source

Thrown at src/applications/drydock/management/DrydockManagementReleaseLeaseWorkflow.php:30

          array(
            'name' => 'id',
            'param' => 'id',
            'repeat' => true,
            'help' => pht('Lease ID to release.'),
          ),
          array(
            'name' => 'all',
            'help' => pht('Release all leases. Dangerous!'),
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $is_all = $args->getArg('all');
    $ids = $args->getArg('id');

    if (!$ids && !$is_all) {
      throw new PhutilArgumentUsageException(
        pht(
          'Select which leases you want to release. See "--help" for '.
          'guidance.'));
    }

    $viewer = $this->getViewer();

    $statuses = $this->getReleaseableLeaseStatuses();

    $query = id(new DrydockLeaseQuery())
      ->setViewer($viewer)
      ->withStatuses(mpull($statuses, 'getKey'));

    if ($ids) {
      $query->withIDs($ids);
    }

    $leases = $query->execute();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Re-run with explicit lease IDs: `./bin/drydock release-lease --id 12 --id 34`
  2. To release everything releaseable at once: `./bin/drydock release-lease --all`
  3. Run `./bin/drydock release-lease --help` to confirm flag names and repeat behavior of `--id`
  4. In automation, pre-flight the argument vector so the script fails before invoking the workflow with an empty selection

Example fix

// before
$ ./bin/drydock release-lease
Usage Exception: Select which leases you want to release. See "--help" for guidance.

// after
$ ./bin/drydock release-lease --id 101 --id 102
Released lease 101.
Released lease 102.
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking the workflow, verify scope is selected:
$ids = $args->getArg('id');
$is_all = $args->getArg('all');
if (!$ids && !$is_all) {
  // print friendly guidance instead of letting the workflow throw
  throw new PhutilArgumentUsageException(pht(
    'Pass --id <n> (repeatable) or --all.'));
}

Try / catch

catch (PhutilArgumentUsageException $ex) { print usage and exit with the CLI's help exit code; treat as retryable after correcting arguments }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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