phacility/phabricator · error · PhutilArgumentUsageException

Specify one or more repositories to act on.

Error message

Specify one or more repositories to act on.

What it means

Usage error from `bin/repository maintenance`: the `repositories` wildcard argument resolved to an empty list. The workflow writes a maintenance-mode message into repository configuration (new content source, applied per repository), so it requires at least one explicit target.

Source

Thrown at src/applications/repository/management/PhabricatorRepositoryManagementMaintenanceWorkflow.php:40

          array(
            'name' => 'stop',
            'help' => pht(
              'Take repositories out of maintenance mode, returning them '.
              'to normal serice.'),
          ),
          array(
            'name' => 'repositories',
            'wildcard' => true,
          ),
        ));
  }

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

    $repositories = $this->loadRepositories($args, 'repositories');
    if (!$repositories) {
      throw new PhutilArgumentUsageException(
        pht('Specify one or more repositories to act on.'));
    }

    $message = $args->getArg('start');
    $is_start = (bool)strlen($message);
    $is_stop = $args->getArg('stop');

    if (!$is_start && !$is_stop) {
      throw new PhutilArgumentUsageException(
        pht(
          'Use "--start <message>" to put repositories into maintenance '.
          'mode, or "--stop" to take them out of maintenance mode.'));
    }

    if ($is_start && $is_stop) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify either "--start" or "--stop", but not both.'));

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Include repository callsigns/IDs: `./bin/repository maintenance R1 R2 --start "upgrading disk"`.
  2. For all repositories, enumerate with `./bin/repository list` and pass the whole list.
  3. Check the callsigns exist if arguments appear to be ignored.

Example fix

// before
$ ./bin/repository maintenance --start "disk upgrade"
[1170] Specify one or more repositories to act on.

// after
$ ./bin/repository maintenance R1 R2 --start "disk upgrade"
Defensive patterns

Strategy: validation

Validate before calling

repos=("$@")
[ ${#repos[@]} -ge 1 ] || { echo 'usage: maintenance <callsign>... (--start <msg> | --stop)' >&2; exit 1; }

Prevention

When it happens

Trigger: Running `./bin/repository maintenance --start "message"` without repository arguments; passing only the `--start`/`--stop` flags; identifiers that resolve to nothing.

Common situations: Operators assume maintenance mode is global and omit the repo list; the callsign portion of a copy-pasted command is dropped.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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