{"record":{"id":"b5b33f7cae761b2f","repo":"phacility/phabricator","slug":"object-s-is-specified-more-than-once-specify-o","errorCode":null,"errorMessage":"Object \"%s\" is specified more than once. Specify only unique objects.","messagePattern":"Object \"(.+?)\" is specified more than once\\. Specify only unique objects\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php","lineNumber":268,"sourceCode":"      $tasks = array_select_keys($tasks, $ids);\n    } else {\n      $tasks = msort($tasks, 'getID');\n    }\n\n    return $tasks;\n  }\n\n  protected function describeTask(PhabricatorWorkerTask $task) {\n    return pht('Task %d (%s)', $task->getID(), $task->getTaskClass());\n  }\n\n  private function loadObjectPHIDsFromArguments(array $names) {\n    $viewer = $this->getViewer();\n\n    $seen_names = array();\n    foreach ($names as $name) {\n      if (isset($seen_names[$name])) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Object \"%s\" is specified more than once. Specify only unique '.\n            'objects.',\n            $name));\n      }\n      $seen_names[$name] = true;\n    }\n\n    $object_query = id(new PhabricatorObjectQuery())\n      ->setViewer($viewer)\n      ->withNames($names);\n\n    $object_query->execute();\n\n    $name_map = $object_query->getNamedResults();\n    $phid_map = array();\n    foreach ($names as $name) {\n      if (!isset($name_map[$name])) {","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php#L250-L286","documentation":"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.","triggerScenarios":"`./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.","commonSituations":"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.","solutions":["Remove the duplicate so each object name appears once","In scripts, de-duplicate the list before building the command: `array_unique($object_names)` or `sort -u`","Check that a shell loop is not appending the same value repeatedly to the args array"],"exampleFix":"# before\n./bin/worker retry --object T123 --object T123 --class X\n\n# after\n./bin/worker retry --object T123 --class X","handlingStrategy":"validation","validationCode":"$names = array_values(array_unique($names)); // drop literal duplicates\n$cmd = './bin/worker '.$subcommand;\nforeach ($names as $name) {\n  $cmd .= ' --object '.escapeshellarg($name);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["De-duplicate object name lists at the source (array_unique / sort -u) before building CLI args","Merge lists from multiple systems through a set, not array concatenation"],"tags":["phabricator","cli","worker-queue","duplicate-argument","argument-validation"],"backgroundTag":"duplicate-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}