phacility/phabricator · warning · PhutilArgumentUsageException

Provide a list of objects to index (like "D123"), or a set o

Error message

Provide a list of objects to index (like "D123"), or a set of query constraint flags (like "--type"), or "--all" to index all objects.

What it means

Usage exception from `bin/search index`: no document selector was supplied. The workflow requires either positional object names, at least one constraint flag (--type, --version, --min-index-date, --max-index-date), or --all. A bare invocation is ambiguous - it could mean 'everything', which is expensive - so it fails fast instead of guessing.

Source

Thrown at src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php:110

    $object_names = $args->getArg('objects');

    $any_constraints =
      ($object_names) ||
      ($object_types) ||
      ($index_versions) ||
      ($min_epoch) ||
      ($max_epoch);

    if ($is_all && $any_constraints) {
      throw new PhutilArgumentUsageException(
        pht(
          'You can not use query constraint flags (like "--version", '.
          '"--type", or a list of specific objects) with "--all".'));
    }

    if (!$is_all && !$any_constraints) {
      throw new PhutilArgumentUsageException(
        pht(
          'Provide a list of objects to index (like "D123"), or a set of '.
          'query constraint flags (like "--type"), or "--all" to index '.
          'all objects.'));
    }


    if ($args->getArg('background')) {
      $is_background = true;
    } else {
      PhabricatorWorker::setRunAllTasksInProcess(true);
      $is_background = false;
    }

    if (!$is_background) {
      $this->logInfo(
        pht('NOTE'),
        pht(

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Name objects explicitly: `bin/search index D123 T456`
  2. Or constrain by type: `bin/search index --type task`
  3. Or index everything: `bin/search index --all` (slow on large installs)
  4. Combine constraints such as `--type task --min-index-date` for batched runs

Example fix

# before
bin/search index

# after
bin/search index --type task
Defensive patterns

Strategy: validation

Validate before calling

$isAll = !empty($args['all']);
$hasSelector = !empty($args['objects']) || !empty($args['type'])
  || !empty($args['version']) || !empty($args['min-index-date'])
  || !empty($args['max-index-date']);
if (!$isAll && !$hasSelector) {
  // refuse before invoking: require an explicit selector
}

Prevention

When it happens

Trigger: Running `bin/search index` with no arguments and no flags, or a script whose variable expansion produced an empty argument list.

Common situations: Exploring the CLI; assumptions that bare `bin/search index` reindexes everything (older behavior in some forks/scripts); truncated or misquoted shell commands in cron.

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