{"record":{"id":"b743d39609433c66","repo":"phacility/phabricator","slug":"no-user-s-exists-specify-users-by-username-id","errorCode":null,"errorMessage":"No user \"%s\" exists. Specify users by username, ID, or PHID.","messagePattern":"No user \"(.+?)\" exists\\. Specify users by username, ID, or PHID\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/management/PhabricatorManagementWorkflow.php","lineNumber":168,"sourceCode":"    }\n\n    if ($ids) {\n      $users = id(new PhabricatorPeopleQuery())\n        ->setViewer($viewer)\n        ->withIDs($ids)\n        ->execute();\n\n      foreach ($users as $user) {\n        $id = $user->getID();\n        $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    }","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/management/PhabricatorManagementWorkflow.php#L150-L186","documentation":"A PhutilArgumentUsageException from the shared user-resolution helper: after resolving all identifiers against usernames, user IDs, and PHIDs, one identifier produced no matches at all. The command names the offending identifier and reminds you of the three accepted notations.","triggerScenarios":"Passing a typo'd or deleted username to --user; passing an ID of a user record that was deleted or never existed; passing a PHID with wrong type prefix or copy-paste error; the user exists but was disbled/renamed so the old username no longer matches.","commonSituations":"Offboarding scripts referencing removed users; renamed accounts breaking hardcoded usernames in maintenance scripts; copy-paste truncating a PHID.","solutions":["Look the user up to get their current exact username, ID, or PHID (e.g. bin/user query or the People application)","If renaming is suspected, resolve by PHID, which is stable across renames","Remove the stale identifier from your script's list and re-run"],"exampleFix":"# before\n$ bin/user edit --user alinciln ...\n\n# after\n$ bin/user edit --user alincoln ...\n# or pin to the immutable PHID\n$ bin/user edit --user PHID-USER-abcd1234 ...","handlingStrategy":"validation","validationCode":"// Resolve identifiers before running the command; fail fast on misses.\n$users = id(new PhabricatorUserQuery())\n  ->setViewer(PhabricatorUser::getOmnipotentUser())\n  ->withUsernames($identifiers)\n  ->execute();\n$missing = array_diff($identifiers, mpull($users, 'getUsername'));\nif ($missing) {\n  fwrite(STDERR, 'Unknown users: '.implode(', ', $missing).\"\\n\");\n  exit(1);\n}","typeGuard":null,"tryCatchPattern":"try { $list = $workflow->selectUsers($users, $identifiers); } catch (PhutilArgumentUsageException $ex) { /* print message; list valid usernames/PHIDs; exit 1 */ }","preventionTips":["Pin long-lived scripts to PHIDs — usernames change on rename, PHIDs do not","Verify identifiers exist right before the run, not from a months-old list"],"tags":["cli","user-management","usage-error","phabricator"],"backgroundTag":"user-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}