phacility/phabricator · warning · PhutilArgumentUsageException

Specify one or more repositories to update refs for.

Error message

Specify one or more repositories to update refs for.

What it means

`bin/repository refs` refreshes ref cursors (branch/tag positions) for the given repositories. The wildcard `repos` arguments are resolved via loadLocalRepositories() to repositories hosted on this device; an empty selection aborts with this PhutilArgumentUsageException before any ref update runs.

Source

Thrown at src/applications/repository/management/PhabricatorRepositoryManagementRefsWorkflow.php:34

          ),
          array(
            'name' => 'rebuild',
            'help' => pht(
              'Publish commits currently reachable from any permanent ref, '.
              'ignoring the cached ref state.'),
          ),
          array(
            'name'        => 'repos',
            'wildcard'    => true,
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $repos = $this->loadLocalRepositories($args, 'repos');

    if (!$repos) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify one or more repositories to update refs for.'));
    }

    $console = PhutilConsole::getConsole();
    foreach ($repos as $repo) {
      $console->writeOut(
        "%s\n",
        pht(
          'Updating refs in "%s"...',
          $repo->getDisplayName()));

      $engine = id(new PhabricatorRepositoryRefEngine())
        ->setRepository($repo)
        ->setVerbose($args->getArg('verbose'))
        ->setRebuild($args->getArg('rebuild'))
        ->updateRefs();
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass an explicit target: `./bin/repository refs XYZ`.
  2. Confirm the callsign with `./bin/repository list-repositories`.
  3. Run the command on the device that hosts the repository's working copy.

Example fix

# before
./bin/repository refs
# Usage exception: Specify one or more repositories to update refs for.

# after
./bin/repository refs XYZ
Defensive patterns

Strategy: validation

Validate before calling

# Confirm the callsign exists and the working copy is on this host
./bin/repository list-repositories | grep -q "^R<callsign>" || exit 1
ls "/var/repo/<callsign>" >/dev/null 2>&1 || { echo "not hosted here" >&2; exit 1; }
./bin/repository refs <callsign>

Prevention

When it happens

Trigger: Executing `./bin/repository refs` with no arguments; passing callsigns that match no locally-hosted repository; running on a host that hosts no working copies.

Common situations: Manual refresh on the wrong cluster node; typo'd callsign; a freshly added repository whose working copy has not been created on this device yet.

Related errors


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