{"record":{"id":"8ddb1af9c94dc256","repo":"phacility/phabricator","slug":"no-such-user-s-exists","errorCode":null,"errorMessage":"No such user \"%s\" exists.","messagePattern":"No such user \"(.+?)\" exists\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php","lineNumber":62,"sourceCode":"    if (!strlen($method)) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify a method to call with \"--method\".'));\n    }\n\n    $input = $args->getArg('input');\n    if (!strlen($input)) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify a file to read parameters from with \"--input\".'));\n    }\n\n    $as = $args->getArg('as');\n    if (strlen($as)) {\n      $actor = id(new PhabricatorPeopleQuery())\n        ->setViewer($viewer)\n        ->withUsernames(array($as))\n        ->executeOne();\n      if (!$actor) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'No such user \"%s\" exists.',\n            $as));\n      }\n\n      // Allow inline generation of user caches for the user we're acting\n      // as, since some calls may read user preferences.\n      $actor->setAllowInlineCacheGeneration(true);\n    } else {\n      $actor = $viewer;\n    }\n\n    if ($input === '-') {\n      fprintf(STDERR, tsprintf(\"%s\\n\", pht('Reading input from stdin...')));\n      $input_json = file_get_contents('php://stdin');\n    } else {\n      $input_json = Filesystem::readFile($input);\n    }","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php#L44-L80","documentation":"When bin/conduit call is given --as <username>, a PhabricatorPeopleQuery restricted with withUsernames() must resolve exactly one user; resolving none raises this PhutilArgumentUsageException naming the value passed. Without --as the call runs as the omnipotent viewer instead.","triggerScenarios":"Passing --as alice when no user named alice exists; wrong casing/whitespace or a copy-pasted display name rather than the username; referencing a deleted or not-yet-created account.","commonSituations":"Scripts hardcoding a bot/admin username that differs per environment (e.g. 'ci-bot' vs 'ci_bot'); using the full name 'Alice Nguyen' where the username is 'alice'.","solutions":["Look the exact username up in the People application (or via user.search) on that install and use it verbatim.","Trim whitespace and check casing of the flag value.","If you intended an administrative call, omit --as to execute as the omnipotent user."],"exampleFix":"# before\n$ ./bin/conduit call --method user.whoami --input p.json --as 'Alice Nguyen'\n# after\n$ ./bin/conduit call --method user.whoami --input p.json --as alice","handlingStrategy":"validation","validationCode":"// Verify the username exists before running the command.\n$actor = id(new PhabricatorPeopleQuery())\n  ->setViewer(PhabricatorUser::getOmnipotentUser())\n  ->withUsernames(array($as_user))\n  ->executeOne();\nif (!$actor) {\n  throw new Exception(pht('Unknown user %s', $as_user));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source --as values from a user.search lookup or a config value per environment, not hardcoded guesses.","Normalize whitespace and casing before passing the flag."],"tags":["conduit","cli","user-not-found","phabricator","php"],"backgroundTag":"user-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}