phacility/phabricator · error · PhutilArgumentUsageException

Use "--start <message>" to put repositories into maintenance

Error message

Use "--start <message>" to put repositories into maintenance mode, or "--stop" to take them out of maintenance mode.

What it means

Usage error from `bin/repository maintenance`: neither `--start <message>` nor `--stop` was supplied (`$is_start` is false because the message is empty, and `$is_stop` is false). The workflow is strictly a toggle between entering and leaving maintenance mode, so it refuses to run with no direction.

Source

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

          ),
        ));
  }

  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.'));
    }

    $content_source = $this->newContentSource();
    $diffusion_phid = id(new PhabricatorDiffusionApplication())->getPHID();

    if ($is_start) {
      $new_value = $message;
    } else {
      $new_value = null;

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. To enter maintenance mode: `./bin/repository maintenance R1 --start "reason"`.
  2. To leave it: `./bin/repository maintenance R1 --stop`.
  3. If scripting, guard against empty messages: `[ -n "$MSG" ] && ./bin/repository maintenance R1 --start "$MSG"`.

Example fix

// before
$ ./bin/repository maintenance R1
[1171] Use "--start <message>" ... or "--stop" ...

// after
$ ./bin/repository maintenance R1 --start "reindexing storage"
Defensive patterns

Strategy: validation

Validate before calling

if [ -n "$MSG" ]; then ./bin/repository maintenance R1 --start "$MSG"; else ./bin/repository maintenance R1 --stop; fi

Prevention

When it happens

Trigger: Running `./bin/repository maintenance R1` with repositories but no mode flags; passing `--start` with an empty string message (`--start ''`), which counts as not starting because the check is `strlen($message)`.

Common situations: Operators forget the mode flag entirely; scripts pass an empty variable message (`--start "$MSG"` with MSG unset) and silently hit the same guard.

Related errors


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