{"record":{"id":"b9ea6a87eaebf290","repo":"phacility/phabricator","slug":"multiple-user-identifiers-s-correspond-to-the-s","errorCode":null,"errorMessage":"Multiple user identifiers (%s) correspond to the same user. Identify each user exactly once.","messagePattern":"Multiple user identifiers \\((.+?)\\) correspond to the same user\\. Identify each user exactly once\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/management/PhabricatorManagementWorkflow.php","lineNumber":139,"sourceCode":"      $users = id(new PhabricatorPeopleQuery())\n        ->setViewer($viewer)\n        ->withUsernames($usernames)\n        ->execute();\n\n      $reverse_map = array();\n      foreach ($usernames as $identifier => $username) {\n        $username = phutil_utf8_strtolower($username);\n        $reverse_map[$username][] = $identifier;\n      }\n\n      foreach ($users as $user) {\n        $username = $user->getUsername();\n        $username = phutil_utf8_strtolower($username);\n\n        $reverse_identifiers = idx($reverse_map, $username, array());\n\n        if (count($reverse_identifiers) > 1) {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Multiple user identifiers (%s) correspond to the same user. '.\n              'Identify each user exactly once.',\n              implode(', ', $reverse_identifiers)));\n        }\n\n        foreach ($reverse_identifiers as $reverse_identifier) {\n          $results[$reverse_identifier][] = $user;\n        }\n      }\n    }\n\n    if ($ids) {\n      $users = id(new PhabricatorPeopleQuery())\n        ->setViewer($viewer)\n        ->withIDs($ids)\n        ->execute();\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/management/PhabricatorManagementWorkflow.php#L121-L157","documentation":"A PhutilArgumentUsageException from the shared user-resolution helper in PhabricatorManagementWorkflow (used by scripts taking --user). Before resolving identifiers, it builds a reverse map from lowercased username to the identifiers that named it; if one user is reached by more than one distinct identifier in the same invocation, the command aborts so each user is edited exactly once.","triggerScenarios":"Passing the same person twice in different notations in one command, e.g. --user alincoln --user @alincoln, or --user alincoln --user PHID-USER-xxxx where both resolve to the same username; duplicate entries in a script-generated identifier list.","commonSituations":"Scripts concatenating username lists and PHID lists without deduplication; batch administration commands where a user appears in two input files.","solutions":["Remove the duplicate: name each user exactly once per invocation (drop either the @username or PHID form)","Deduplicate your identifier list before building the command: array_unique / sort -u","Normalize identifiers to a single notation (all usernames or all PHIDs) in generating scripts"],"exampleFix":"# before\n$ bin/user edit --user alincoln --user @alincoln ...\n\n# after\n$ bin/user edit --user alincoln ...","handlingStrategy":"validation","validationCode":"// Normalize and dedupe identifiers (case-insensitive) before invoking\n// a workflow that resolves users.\n$usernames = array_map('phutil_utf8_strtolower', $usernames);\n$identifiers = array_unique($identifiers);\n$usernames = array_unique($usernames);","typeGuard":null,"tryCatchPattern":"try { $users = $workflow->selectUsers($users, $identifiers); } catch (PhutilArgumentUsageException $ex) { /* report duplicate, ask user to name each person once */ }","preventionTips":["Generate --user lists from a single canonical source (e.g. PHIDs only) and run array_unique/sort -u before use","Do not mix @username and bare-username forms for the same person in one command"],"tags":["cli","user-management","duplicate-argument","usage-error","phabricator"],"backgroundTag":"duplicate-identifier","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}