{"record":{"id":"0fe5bba313fdfff6","repo":"phacility/phabricator","slug":"you-must-specify-the-username-of-the-account-to-re","errorCode":null,"errorMessage":"You must specify the username of the account to recover.","messagePattern":"You must specify the username of the account to recover\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php","lineNumber":31,"sourceCode":"      ->setArguments(\n        array(\n          array(\n            'name' => 'force-full-session',\n            'help' => pht(\n              'Recover directly into a full session without requiring MFA '.\n              'or other login checks.'),\n          ),\n          array(\n            'name' => 'username',\n            'wildcard' => true,\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $usernames = $args->getArg('username');\n    if (!$usernames) {\n      throw new PhutilArgumentUsageException(\n        pht('You must specify the username of the account to recover.'));\n    } else if (count($usernames) > 1) {\n      throw new PhutilArgumentUsageException(\n        pht('You can only recover the username for one account.'));\n    }\n\n    $username = head($usernames);\n\n    $user = id(new PhabricatorPeopleQuery())\n      ->setViewer($this->getViewer())\n      ->withUsernames(array($username))\n      ->executeOne();\n\n    if (!$user) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'No such user \"%s\" to recover.',\n          $username));","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php#L13-L49","documentation":"The bin/auth recover workflow requires exactly one username as a wildcard argument. With no username supplied, getArg('username') is empty and the workflow aborts with a usage exception before any user lookup.","triggerScenarios":"Running './bin/auth recover' with no arguments, or a wrapper script dropping the username parameter.","commonSituations":"Assuming the tool prompts for a username; copy-pasting an example command without substituting a real username; argument dropped in shell quoting mistakes.","solutions":["Run ./bin/auth recover <username> with the exact account username.","Optionally add --force-full-session when the recovery link must grant a full (not partial) session.","Check ./bin/auth help recover for the supported options."],"exampleFix":"// before\n./bin/auth recover\n// after\n./bin/auth recover alincoln","handlingStrategy":"validation","validationCode":"# guard the argument before invoking\n[ \"$#\" -eq 1 ] || { echo 'usage: auth recover <username>' >&2; exit 2; }\n./bin/auth recover \"$1\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check ./bin/auth help recover for the exact invocation.","Always pass exactly one username.","In wrappers, fail fast when the username variable is empty."],"tags":["cli","usage","account-recovery","phabricator"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}