phacility/phabricator · warning · PhutilArgumentUsageException

Use "--id" or "--active" to select builds.

Error message

Use "--id" or "--active" to select builds.

What it means

Usage exception from 'bin/harbormaster restart'. The command must be told which builds to restart: specific builds via one or more --id flags, or every currently active build via --active. With neither selection the command has no target set, so it aborts rather than doing nothing.

Source

Thrown at src/applications/harbormaster/management/HarbormasterManagementRestartWorkflow.php:34

            'name' => 'id',
            'param' => 'id',
            'repeat' => true,
            'help' => pht('Select one or more builds by ID.'),
          ),
          array(
            'name' => 'active',
            'help' => pht('Select all active builds.'),
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();
    $ids = $args->getArg('id');
    $active = $args->getArg('active');

    if (!$ids && !$active) {
      throw new PhutilArgumentUsageException(
        pht('Use "--id" or "--active" to select builds.'));
    } if ($ids && $active) {
      throw new PhutilArgumentUsageException(
        pht('Use one of "--id" or "--active" to select builds, but not both.'));
    }

    $query = id(new HarbormasterBuildQuery())
      ->setViewer($viewer);
    if ($ids) {
      $query->withIDs($ids);
    } else {
      $query->withBuildStatuses(
        HarbormasterBuildStatus::getActiveStatusConstants());
    }
    $builds = $query->execute();

    $count = count($builds);
    if (!$count) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Restart specific builds: 'bin/harbormaster restart --id 15 --id 16'
  2. Restart every active build: 'bin/harbormaster restart --active'
  3. Find build IDs from the build page URI (/build/15/ means --id 15)

Example fix

# before
$ bin/harbormaster restart
# after
$ bin/harbormaster restart --active
Defensive patterns

Strategy: validation

Validate before calling

# shell wrapper before invoking restart
if [ -z ${BUILD_IDS:-} ] && [ ${RESTART_ACTIVE:-0} -eq 0 ]; then
  echo 'error: pass --id <id> or --active' >&2
  exit 1
fi

Prevention

When it happens

Trigger: Running 'bin/harbormaster restart' with no arguments.

Common situations: An operator forgets the flags; an automation script expands an empty list variable so no --id is passed.

Related errors


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