phacility/phabricator · warning · PhutilArgumentUsageException

Choose a build log to rebuild with "--id", or rebuild all lo

Error message

Choose a build log to rebuild with "--id", or rebuild all logs with "--all".

What it means

Usage exception from 'bin/harbormaster rebuild-log'. The command reconstructs raw build log content (for example after a change in storage format) and must know its scope: one log selected with --id, or every log with --all. When neither flag is given there is nothing to rebuild, so the workflow refuses to start instead of doing a silent no-op.

Source

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

          array(
            'name' => 'force',
            'help' => pht(
              'Force logs to rebuild even if they appear to be in good '.
              'shape already.'),
          ),
        ));
  }

  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) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Add '--id <log-id>' to rebuild one log; the ID is the number in the build log URI
  2. Add '--all' to rebuild every build log in the instance
  3. Run 'bin/harbormaster rebuild-log --help' to confirm the accepted flags before scripting it

Example fix

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

Strategy: validation

Validate before calling

# shell wrapper before invoking rebuild-log
if [ -z ${LOG_ID:-} ] && [ ${REBUILD_ALL:-0} -eq 0 ]; then
  echo 'error: pass --id <id> or --all' >&2
  exit 1
fi

Prevention

When it happens

Trigger: Running 'bin/harbormaster rebuild-log' with no options at all.

Common situations: An operator copies the command from documentation without parameters; an automation script builds the command line from variables that are unset, so both flags end up omitted.

Related errors


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