phacility/phabricator · info · PhutilArgumentUsageException

Specify a commit to look up with `%s`.

Error message

Specify a commit to look up with `%s`.

What it means

Usage error from the 'bin/repository cache' management workflow: the command inspects the last-modified graph cache for a commit and path pair, and --commit was not supplied. PhutilArgumentUsageException signals malformed command-line invocation; the command aborts before doing any work.

Source

Thrown at src/applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php:31

        array(
          array(
            'name'    => 'commit',
            'param'   => 'commit',
            'help'    => pht('Specify a commit to look up.'),
          ),
          array(
            'name'    => 'path',
            'param'   => 'path',
            'help'    => pht('Specify a path to look up.'),
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {

    $commit_name = $args->getArg('commit');
    if ($commit_name === null) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify a commit to look up with `%s`.',
          '--commit'));
    }
    $commit = $this->loadNamedCommit($commit_name);

    $path_name = $args->getArg('path');
    if ($path_name === null) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify a path to look up with `%s`.',
          '--path'));
    }

    $path_map = id(new DiffusionPathIDQuery(array($path_name)))
      ->loadPathIDs();
    if (empty($path_map[$path_name])) {
      throw new PhutilArgumentUsageException(

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Re-run with --commit <identifier>, e.g. 'bin/repository cache --commit abc123 --path /src'
  2. Run 'bin/repository cache --help' to confirm current flag names before scripting it

Example fix

# before
bin/repository cache --path /src

# after
bin/repository cache --commit abc123ef --path /src
Defensive patterns

Strategy: validation

Validate before calling

// Wrap CLI invocation: check args before running
if (!isset($opts['commit'])) {
  fwrite(STDERR, "usage: bin/repository cache --commit <sha> --path <path>\n");
  exit(1);
}

Prevention

When it happens

Trigger: Running 'bin/repository cache' without arguments, or with only --path supplied; the null check on getArg('commit') fails before anything runs.

Common situations: Admin exploring cache internals and forgetting the required flag; scripts written against a different version of the workflow with changed flags.

Related errors


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