phacility/phabricator · error · PhutilArgumentUsageException

Specify one or more repositories to lock.

Error message

Specify one or more repositories to lock.

What it means

Usage error from `bin/repository lock`: `loadRepositories($args, 'repositories')` resolved no repositories from the wildcard argument. The workflow takes cluster write locks on repositories via `PhabricatorGlobalLock`, so it refuses to run without an explicit target list.

Source

Thrown at src/applications/repository/management/PhabricatorRepositoryManagementLockWorkflow.php:27

      ->setExamples('**lock** [options] __repository__ ...')
      ->setSynopsis(
        pht(
          'Temporarily lock clustered repositories to perform maintenance.'))
      ->setArguments(
        array(
          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 lock.'));
    }

    foreach ($repositories as $repository) {
      $display_name = $repository->getDisplayName();

      if (!$repository->isHosted()) {
        throw new PhutilArgumentUsageException(
          pht(
            'Unable to lock repository "%s": only hosted repositories may be '.
            'locked.',
            $display_name));
      }

      if (!$repository->supportsSynchronization()) {
        throw new PhutilArgumentUsageException(
          pht(
            'Unable to lock repository "%s": only repositories that support '.

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass repository callsigns/IDs: `./bin/repository lock R1`.
  2. Lock every cluster repository by passing the full list from `./bin/repository list`.
  3. Confirm the callsigns are valid if the argument list seems ignored.

Example fix

// before
$ ./bin/repository lock
[1166] Specify one or more repositories to lock.

// after
$ ./bin/repository lock R1 R2
Defensive patterns

Strategy: validation

Validate before calling

[ $# -ge 1 ] || { echo 'usage: lock <callsign>...' >&2; exit 1; }
./bin/repository lock "$@"

Prevention

When it happens

Trigger: Running `./bin/repository lock` with no repository arguments; passing flags only; identifiers that do not resolve to any repository.

Common situations: Operators attempt a global maintenance lock and forget the command is per-repository; shell glob passed unquoted expands to nothing.

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/ef33c097adf2a88d. Report an issue: GitHub.