phacility/phabricator · warning · PhutilArgumentUsageException

Type specification "%s" duplicates type specification "%s".

Error message

Type specification "%s" duplicates type specification "%s". Specify each type only once.

What it means

In `bin/search index --type`, each value is normalized with phutil_utf8_strtolower and tracked in a map keyed by the normalized name. When a later --type value lowercases to the same key as an earlier one, this usage exception is thrown listing the duplicate pair (e.g. "TASK" duplicates "task"). Case differences do not create distinct types.

Source

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

    }

    return mpull($objects, 'getPHID');
  }

  private function getIndexableObjectsByTypes(array $types) {
    $objects = id(new PhutilClassMapQuery())
      ->setAncestorClass('PhabricatorIndexableInterface')
      ->execute();

    $type_map = array();
    $normal_map = array();
    foreach ($types as $type) {
      $normalized_type = phutil_utf8_strtolower($type);
      $type_map[$type] = $normalized_type;

      if (isset($normal_map[$normalized_type])) {
        $old_type = $normal_map[$normalized_type];
        throw new PhutilArgumentUsageException(
          pht(
            'Type specification "%s" duplicates type specification "%s". '.
            'Specify each type only once.',
            $type,
            $old_type));
      }

      $normal_map[$normalized_type] = $type;
    }

    $object_matches = array();

    $matches_map = array();
    $exact_map = array();
    foreach ($objects as $object) {
      $object_class = get_class($object);

      if (!$types) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Remove the duplicate so each type appears once
  2. In scripts, normalize the type list first: lowercase + array_unique before building the command
  3. Use the canonical class name or documented short forms ("task", "commit", "revision") consistently

Example fix

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

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

Strategy: validation

Validate before calling

// Normalize and dedupe before building the command line
$types = array_values(array_unique(array_map('strtolower', $rawTypes)));

Prevention

When it happens

Trigger: `bin/search index --type task --type TASK`, `--type ManiphestTask --type maniphesttask`, or any repeated --type whose values differ only by case.

Common situations: Generated command lines that append flags in a loop without normalizing; merging flag lists from multiple sources; copy-paste duplication of examples with different casing.

Related errors


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