phacility/phabricator · info · PhutilArgumentUsageException

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

Error message

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

What it means

Usage error from the 'bin/repository cache' workflow: --commit was provided and resolved via loadNamedCommit, but --path was not supplied. The command needs both a commit and a path to look up the last-modified graph cache entry; it aborts with PhutilArgumentUsageException before querying anything.

Source

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

            '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(
        pht('Path "%s" is not unknown.', $path_name));
    }
    $path_id = $path_map[$path_name];

    $graph_cache = new PhabricatorRepositoryGraphCache();

    $t_start = microtime(true);
    $cache_result = $graph_cache->loadLastModifiedCommitID(
      $commit->getID(),

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Re-run with both flags: 'bin/repository cache --commit <sha> --path /src/file.php'
  2. Check 'bin/repository cache --help' to review the options

Example fix

# before
bin/repository cache --commit abc123ef

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

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Running 'bin/repository cache --commit <sha>' alone; forgetting the path half of the lookup pair during cache debugging.

Common situations: Admin testing whether a specific commit is cached and forgetting that the lookup is per (commit, path) pair.

Related errors


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