{"record":{"id":"c09f065df16210b0","repo":"phacility/phabricator","slug":"no-such-user-s-exists-c09f06","errorCode":null,"errorMessage":"No such user '%s' exists.","messagePattern":"No such user '(.+?)' exists\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php","lineNumber":97,"sourceCode":"    }\n\n    $type_map = PhabricatorMailExternalMessage::getAllMessageTypes();\n    if (!isset($type_map[$type])) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Message type \"%s\" is unknown, supported message types are: %s.',\n          $type,\n          implode(', ', array_keys($type_map))));\n    }\n\n    $from = $args->getArg('from');\n    if ($from) {\n      $user = id(new PhabricatorPeopleQuery())\n        ->setViewer($viewer)\n        ->withUsernames(array($from))\n        ->executeOne();\n      if (!$user) {\n        throw new PhutilArgumentUsageException(\n          pht(\"No such user '%s' exists.\", $from));\n      }\n      $from = $user;\n    }\n\n    $tos = $args->getArg('to');\n    $ccs = $args->getArg('cc');\n\n    if (!$tos && !$ccs) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify one or more users to send a message to with \"--to\" and/or '.\n          '\"--cc\".'));\n    }\n\n    $names = array_merge($tos, $ccs);\n    $users = id(new PhabricatorPeopleQuery())\n      ->setViewer($viewer)","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php#L79-L115","documentation":"Thrown by `bin/mail send-test` when `--from` names a user that PhabricatorPeopleQuery::withUsernames() cannot resolve for the workflow's viewer. The lookup is an exact, case-sensitive match on the username column, so a typo, a wrong case, a nonexistent user, or a user invisible to the viewer all produce this exception. It is a PhutilArgumentUsageException raised before the mail is built.","triggerScenarios":"`--from alincoln` when no user with that exact username exists; passing a real name ('Abraham Lincoln') or an email address instead of a username; running the workflow with a viewer whose policy filters hide the target user.","commonSituations":"Copy-pasting display names from the People application instead of usernames; renamed or deleted accounts; installations where usernames differ from the email local part.","solutions":["Get the exact username from the user's profile URL or the People application and retry.","Omit --from; the test mail is generated without an explicit From actor.","If scripting, verify the username first with a People query (or `bin/user search`) before invoking send-test."],"exampleFix":"// before\n$ bin/mail send-test --from alincoln@example.com --to hsimmons\n// Exception: No such user 'alincoln@example.com' exists.\n\n// after\n$ bin/mail send-test --from alincoln --to hsimmons","handlingStrategy":"validation","validationCode":"// Resolve the username with the same query before invoking the workflow:\n$user = id(new PhabricatorPeopleQuery())\n  ->setViewer(PhabricatorUser::getOmnipotentUser())\n  ->withUsernames(array($from))\n  ->executeOne();\nif (!$user) {\n  fwrite(STDERR, \"Unknown username: {$from}\\n\");\n  exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  // invoke the workflow\n} catch (PhutilArgumentUsageException $ex) {\n  // $ex->getMessage() names the failing username\n  fwrite(STDERR, $ex->getMessage().\"\\n\");\n  exit(1);\n}","preventionTips":["Treat --from as a username field, never an email address.","Copy usernames from profile URLs (the segment after /p/).","In automation, pre-resolve usernames to PHIDs with a People query so failures surface with your own diagnostics."],"tags":["php","phabricator","cli","user-lookup","mail"],"backgroundTag":"user-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}