phacility/phabricator · warning · PhutilArgumentUsageException

No such user "%s" to recover.

Error message

No such user "%s" to recover.

What it means

PhabricatorPeopleQuery->withUsernames(array($username))->executeOne() returns null: the exact, case-sensitive username matches no Phabricator user account, so there is nothing to generate a recovery link for and the workflow aborts.

Source

Thrown at src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php:46

  public function execute(PhutilArgumentParser $args) {
    $usernames = $args->getArg('username');
    if (!$usernames) {
      throw new PhutilArgumentUsageException(
        pht('You must specify the username of the account to recover.'));
    } else if (count($usernames) > 1) {
      throw new PhutilArgumentUsageException(
        pht('You can only recover the username for one account.'));
    }

    $username = head($usernames);

    $user = id(new PhabricatorPeopleQuery())
      ->setViewer($this->getViewer())
      ->withUsernames(array($username))
      ->executeOne();

    if (!$user) {
      throw new PhutilArgumentUsageException(
        pht(
          'No such user "%s" to recover.',
          $username));
    }

    if (!$user->canEstablishWebSessions()) {
      throw new PhutilArgumentUsageException(
        pht(
          'This account ("%s") can not establish web sessions, so it is '.
          'not possible to generate a functional recovery link. Special '.
          'accounts like daemons and mailing lists can not log in via the '.
          'web UI.',
          $username));
    }

    $force_full_session = $args->getArg('force-full-session');

    $engine = new PhabricatorAuthSessionEngine();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Verify the exact username spelling and case in the People application (or copy it from the user's profile URL).
  2. If the user was renamed, recover using the current username, not the old one.
  3. If no Phabricator account exists yet, create/import one first — recovery applies only to existing accounts.
Defensive patterns

Strategy: validation

Validate before calling

// Verify before invoking the workflow.
$user = id(new PhabricatorPeopleQuery())
  ->setViewer(PhabricatorUser::getOmnipotentUser())
  ->withUsernames(array($username))
  ->executeOne();
if (!$user) {
  // fail early with 'unknown username' instead of running the workflow
}

Prevention

When it happens

Trigger: Typo or case mismatch in the username argument; the user was renamed, disabled, or deleted; attempting to recover a name that exists only in an external directory (LDAP/SSO) but has never logged in to create a Phabricator account.

Common situations: Case-sensitive username mismatches; retired/renamed accounts; assuming directory users exist in Phabricator before first login.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/87c13b3f1b49998b. Report an issue: GitHub.