{"record":{"id":"c37cabe8865709e0","repo":"phacility/phabricator","slug":"no-such-user-s-exists-c37cab","errorCode":null,"errorMessage":"No such user '%s' exists.","messagePattern":"No such user '(.+?)' exists\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php","lineNumber":83,"sourceCode":"          ->withPHIDs(array($default_phid))\n          ->executeOne();\n        if ($default_user) {\n          $as = $default_user->getUsername();\n        }\n      }\n    }\n\n    if (!$as) {\n      throw new PhutilArgumentUsageException(\n        pht(\"Use '--as' to specify the acting user.\"));\n    }\n\n    $user = id(new PhabricatorPeopleQuery())\n      ->setViewer($this->getViewer())\n      ->withUsernames(array($as))\n      ->executeOne();\n    if (!$user) {\n      throw new PhutilArgumentUsageException(\n        pht(\"No such user '%s' exists.\", $as));\n    }\n\n\n    $from = $args->getArg('from');\n    if (!$from) {\n      $from = $user->loadPrimaryEmail()->getAddress();\n    }\n\n    $cc = $args->getArg('cc');\n\n    $console->writeErr(\"%s\\n\", pht('Reading message body from stdin...'));\n    $body = file_get_contents('php://stdin');\n\n    $received = new PhabricatorMetaMTAReceivedMail();\n    $header_content = array(\n      'Message-ID' => Filesystem::readRandomCharacters(12),\n      'From'       => $from,","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php#L65-L101","documentation":"A --as value was supplied, but PhabricatorPeopleQuery->withUsernames(array($as))->executeOne() found no user with that exact username, so the workflow aborts before simulating delivery. The lookup matches the username string only - not email, not display name, not PHID.","triggerScenarios":"Passing a typo'd username, a user who was renamed or deleted, an email address, or a display name ('Abraham Lincoln') instead of the username ('alincoln') to --as.","commonSituations":"Copy-pasting from the UI where display names are shown; renamed users; scripts carrying stale usernames.","solutions":["Use the exact stored username (case included): ./bin/mail receive-test --to T123 --as alincoln.","Look the username up in the People application (or People query) if unsure; do not pass the email address.","If the user was renamed, update your script to the new username."],"exampleFix":"# before (display name / email)\n./bin/mail receive-test --to T123 --as 'abraham.lincoln@example.com'\n\n# after (exact username)\n./bin/mail receive-test --to T123 --as alincoln","handlingStrategy":"validation","validationCode":"// Resolve the acting user by username before building the command.\n$user = id(new PhabricatorPeopleQuery())\n  ->setViewer($admin)\n  ->withUsernames(array($as))\n  ->executeOne();\nif (!$user) {\n  // pick a real username instead of failing inside receive-test\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the exact username (not email or display name) for --as.","In scripts, resolve usernames dynamically rather than hard-coding them."],"tags":["phabricator","cli","mail","user-not-found"],"backgroundTag":"user-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}