{"record":{"id":"34b59a9ad20dbf0b","repo":"phacility/phabricator","slug":"identifier-s-matches-multiple-users-specify-ea","errorCode":null,"errorMessage":"Identifier \"%s\" matches multiple users. Specify each user unambiguously with \"@username\" or by using user PHIDs.","messagePattern":"Identifier \"(.+?)\" matches multiple users\\. Specify each user unambiguously with \"@username\" or by using user PHIDs\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/management/PhabricatorManagementWorkflow.php","lineNumber":178,"sourceCode":"        $results[$id][] = $user;\n      }\n    }\n\n    $list = array();\n    foreach ($identifiers as $identifier) {\n      $users = idx($results, $identifier, array());\n      if (!$users) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'No user \"%s\" exists. Specify users by username, ID, or PHID.',\n            $identifier));\n      }\n\n      if (count($users) > 1) {\n        // This can happen if you have a user \"@25\", a user with ID 25, and\n        // specify \"--user 25\". You can disambiguate this by specifying\n        // \"--user @25\".\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Identifier \"%s\" matches multiple users. Specify each user '.\n            'unambiguously with \"@username\" or by using user PHIDs.',\n            $identifier));\n      }\n\n      $list[] = head($users);\n    }\n\n    return $list;\n  }\n\n}\n","sourceCodeStart":160,"sourceCodeEnd":192,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/management/PhabricatorManagementWorkflow.php#L160-L192","documentation":"A PhutilArgumentUsageException from the shared user-resolution helper: a single identifier matched more than one user because the notations overlap — the code comment gives the canonical case, a user literally named '25' plus a user with numeric ID 25, so '--user 25' is ambiguous. The helper refuses to guess; disambiguate with '@username' (forces username interpretation) or a user PHID.","triggerScenarios":"A numeric identifier that is simultaneously a valid user ID and a numeric username; occasionally an identifier matching a username case-insensitively and another field.","commonSituations":"Installs that auto-assigned numeric usernames ('25', '1089') colliding with user IDs; import scripts passing bare numbers for users whose usernames are also numeric.","solutions":["Prefix the identifier with '@' to force username matching: --user @25","Use the user's PHID, which is unambiguous: --user PHID-USER-xxxx","Long term, avoid purely numeric usernames so IDs and usernames cannot collide"],"exampleFix":"# before: matches user ID 25 AND user named \"25\"\n$ bin/user edit --user 25 ...\n\n# after: unambiguous forms\n$ bin/user edit --user @25 ...\n$ bin/user edit --user PHID-USER-xyzw1234 ...","handlingStrategy":"validation","validationCode":"// Avoid ID/username collisions: always prefix usernames with '@'.\n$identifiers = array_map(\n  function ($id) {\n    return preg_match('/^\\d+$/', $id) ? \"@{$id}\" : $id;\n  },\n  $identifiers);","typeGuard":null,"tryCatchPattern":"try { $list = $workflow->selectUsers($users, $identifiers); } catch (PhutilArgumentUsageException $ex) { /* on ambiguity message, re-run with @username or PHID forms */ }","preventionTips":["Never pass bare numbers when numeric usernames may exist; use @username or PHID-USER-... instead","Avoid creating purely numeric usernames when provisioning accounts"],"tags":["cli","user-management","ambiguity","usage-error","phabricator"],"backgroundTag":"ambiguous-identifier","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}