{"record":{"id":"a722a3f07579d5fd","repo":"phacility/phabricator","slug":"select-a-user-account-to-act-on-with-user-user","errorCode":null,"errorMessage":"Select a user account to act on with \"--user <username>\".","messagePattern":"Select a user account to act on with \"--user <username>\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/people/management/PhabricatorPeopleManagementWorkflow.php","lineNumber":20,"sourceCode":"\nabstract class PhabricatorPeopleManagementWorkflow\n  extends PhabricatorManagementWorkflow {\n\n  final protected function getUserSelectionArguments() {\n    return array(\n      array(\n        'name' => 'user',\n        'param' => 'username',\n        'help' => pht('User account to act on.'),\n      ),\n    );\n  }\n\n  final protected function selectUser(PhutilArgumentParser $argv) {\n    $username = $argv->getArg('user');\n\n    if (!strlen($username)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Select a user account to act on with \"--user <username>\".'));\n    }\n\n    $user = id(new PhabricatorPeopleQuery())\n      ->setViewer($this->getViewer())\n      ->withUsernames(array($username))\n      ->executeOne();\n    if (!$user) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'No user with username \"%s\" exists.',\n          $username));\n    }\n\n    return $user;\n  }\n","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/people/management/PhabricatorPeopleManagementWorkflow.php#L2-L38","documentation":"selectUser() in the shared PhabricatorPeopleManagementWorkflow base class requires a --user argument; every subcommand (approve, disable, enable, empower, ...) resolves its target through it. When the argument is absent or an empty string (strlen check), the workflow aborts with this PhutilArgumentUsageException before any query runs. It is purely a command-line usage error.","triggerScenarios":"Running `./bin/people approve` with no flags; passing an explicitly empty value like `--user ''`; shell scripts where the username variable is unset/unset-checked and expands to nothing.","commonSituations":"Scripts without `set -u` letting empty variables through; copy-pasted examples with the placeholder left in; CI jobs where the username parameter was never injected.","solutions":["Add `--user <username>` to the command","Guard scripts with `[ -n \"$USERNAME\" ]` (or enable `set -u`) so empty values fail early with your own message","Run `./bin/people <command> --help` to confirm the expected arguments"],"exampleFix":"# before\n./bin/people approve\n# after\n./bin/people approve --user alice","handlingStrategy":"validation","validationCode":"# bash: fail fast when the username is missing/empty\n: \"${USERNAME:?usage: --user <username> is required}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --user explicitly to people-management subcommands","Use `set -u` (or ${VAR:?}) in shell scripts so empty variables abort early","Check `./bin/people <command> --help` when unsure of the argument shape"],"tags":["phabricator","cli","missing-argument","people","phutil"],"backgroundTag":"missing-required-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}