phacility/phabricator · warning · PhutilArgumentUsageException

Object "%s" is specified more than once. Specify only unique

Error message

Object "%s" is specified more than once. Specify only unique objects.

What it means

Thrown while resolving `--object` / `--container` name arguments in worker management commands: the same literal name string appears more than once in the argument list. The workflow builds a de-duplicated PHID list and rejects duplicates up front because acting on the same object twice is almost always a scripting mistake. This is a pure string check, before any database lookup.

Source

Thrown at src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php:268

      $tasks = array_select_keys($tasks, $ids);
    } else {
      $tasks = msort($tasks, 'getID');
    }

    return $tasks;
  }

  protected function describeTask(PhabricatorWorkerTask $task) {
    return pht('Task %d (%s)', $task->getID(), $task->getTaskClass());
  }

  private function loadObjectPHIDsFromArguments(array $names) {
    $viewer = $this->getViewer();

    $seen_names = array();
    foreach ($names as $name) {
      if (isset($seen_names[$name])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Object "%s" is specified more than once. Specify only unique '.
            'objects.',
            $name));
      }
      $seen_names[$name] = true;
    }

    $object_query = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withNames($names);

    $object_query->execute();

    $name_map = $object_query->getNamedResults();
    $phid_map = array();
    foreach ($names as $name) {
      if (!isset($name_map[$name])) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Remove the duplicate so each object name appears once
  2. In scripts, de-duplicate the list before building the command: `array_unique($object_names)` or `sort -u`
  3. Check that a shell loop is not appending the same value repeatedly to the args array

Example fix

# before
./bin/worker retry --object T123 --object T123 --class X

# after
./bin/worker retry --object T123 --class X
Defensive patterns

Strategy: validation

Validate before calling

$names = array_values(array_unique($names)); // drop literal duplicates
$cmd = './bin/worker '.$subcommand;
foreach ($names as $name) {
  $cmd .= ' --object '.escapeshellarg($name);
}

Prevention

When it happens

Trigger: `./bin/worker retry --object T123 --object T123 --class X` or the same PHID passed twice via a repeatable flag. Any repeated identical name string within one invocation.

Common situations: Scripts concatenating object lists from multiple sources (e.g. two search results) without de-duplicating; loops appending to a flag array that already contains the value; copy-paste duplication in hand-built commands.

Related errors


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