phacility/phabricator · warning · PhutilArgumentUsageException

You can not specify both "--id" and "--all". Choose one or t

Error message

You can not specify both "--id" and "--all". Choose one or the other.

What it means

Usage exception from 'bin/harbormaster rebuild-log'. The --id flag selects a single log and --all selects every log, so passing both is ambiguous (--all already includes the single log). The workflow enforces mutual exclusivity and aborts before running any queries.

Source

Thrown at src/applications/harbormaster/management/HarbormasterManagementRebuildLogWorkflow.php:53

  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();

    $is_force = $args->getArg('force');

    $log_id = $args->getArg('id');
    $is_all = $args->getArg('all');

    if (!$is_all && !$log_id) {
      throw new PhutilArgumentUsageException(
        pht(
          'Choose a build log to rebuild with "--id", or rebuild all '.
          'logs with "--all".'));
    }

    if ($is_all && $log_id) {
      throw new PhutilArgumentUsageException(
        pht(
          'You can not specify both "--id" and "--all". Choose one or '.
          'the other.'));
    }

    if ($log_id) {
      $log = id(new HarbormasterBuildLogQuery())
        ->setViewer($viewer)
        ->withIDs(array($log_id))
        ->executeOne();
      if (!$log) {
        throw new PhutilArgumentUsageException(
          pht(
            'Unable to load build log "%s".',
            $log_id));
      }
      $logs = array($log);
    } else {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Remove --all and keep '--id 42' to rebuild exactly one log
  2. Or remove --id and keep --all to rebuild every log
  3. Make wrapper scripts pass exactly one of the two flags (xor logic), never both

Example fix

# before
$ bin/harbormaster rebuild-log --id 42 --all
# after
$ bin/harbormaster rebuild-log --id 42
Defensive patterns

Strategy: validation

Validate before calling

# shell wrapper: exactly one of --id / --all
if [ -n ${LOG_ID:-} ] && [ ${REBUILD_ALL:-0} -eq 1 ]; then
  echo 'error: --id and --all are mutually exclusive' >&2
  exit 1
fi

Prevention

When it happens

Trigger: Running 'bin/harbormaster rebuild-log --id 42 --all'.

Common situations: A wrapper script that always passes --all and conditionally appends --id; command lines assembled by combining examples from two different runbook entries.

Related errors


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