phacility/phabricator · warning · PhutilArgumentUsageException

You can not use query constraint flags (like "--version", "-

Error message

You can not use query constraint flags (like "--version", "--type", or a list of specific objects) with "--all".

What it means

Usage exception from `bin/search index`: the --all flag and any query constraint are mutually exclusive. The workflow computes $any_constraints from positional object names, --type, --version, --min-index-date, or --max-index-date, and refuses to run when --all is also given, because --all already fully defines the document set.

Source

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

      $min_epoch = $this->parseTimeArgument($min_epoch);
    }

    $max_epoch = $args->getArg('max-index-date');
    if ($max_epoch !== null) {
      $max_epoch = $this->parseTimeArgument($max_epoch);
    }

    $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);

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Drop --all and keep the constraints: `bin/search index --type task`
  2. Or drop the constraints to index everything: `bin/search index --all`
  3. For 'all objects of a type', --type alone already selects the full set for that type
  4. Run `bin/search help index` to confirm the current flag semantics

Example fix

# before
bin/search index --all --type task

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

Strategy: validation

Validate before calling

// Before shelling out, enforce the exclusivity the workflow enforces
$isAll = !empty($args['all']);
$hasConstraints = !empty($args['objects']) || !empty($args['type'])
  || !empty($args['version']) || !empty($args['min-index-date'])
  || !empty($args['max-index-date']);
if ($isAll && $hasConstraints) {
  // choose one mode; do not invoke bin/search index
}

Try / catch

try {
  $workflow->execute($args);
} catch (PhutilArgumentUsageException $ex) {
  // fix the invocation; the message names the conflicting flags
}

Prevention

When it happens

Trigger: Commands like `bin/search index --all --type task`, `bin/search index --all D123`, `bin/search index --all --version 3`, or `bin/search index --all --min-index-date 2020-01-01`.

Common situations: Scripts written against older workflows that allowed combining --all with filters; copy-pasting examples and appending --all 'to be safe'; attempting 'reindex everything of one type' by adding --all.

Related errors


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