phacility/phabricator · warning · PhutilArgumentUsageException

No user "%s" exists. Specify users by username, ID, or PHID.

Error message

No user "%s" exists. Specify users by username, ID, or PHID.

What it means

A PhutilArgumentUsageException from the shared user-resolution helper: after resolving all identifiers against usernames, user IDs, and PHIDs, one identifier produced no matches at all. The command names the offending identifier and reminds you of the three accepted notations.

Source

Thrown at src/infrastructure/management/PhabricatorManagementWorkflow.php:168

    }

    if ($ids) {
      $users = id(new PhabricatorPeopleQuery())
        ->setViewer($viewer)
        ->withIDs($ids)
        ->execute();

      foreach ($users as $user) {
        $id = $user->getID();
        $results[$id][] = $user;
      }
    }

    $list = array();
    foreach ($identifiers as $identifier) {
      $users = idx($results, $identifier, array());
      if (!$users) {
        throw new PhutilArgumentUsageException(
          pht(
            'No user "%s" exists. Specify users by username, ID, or PHID.',
            $identifier));
      }

      if (count($users) > 1) {
        // This can happen if you have a user "@25", a user with ID 25, and
        // specify "--user 25". You can disambiguate this by specifying
        // "--user @25".
        throw new PhutilArgumentUsageException(
          pht(
            'Identifier "%s" matches multiple users. Specify each user '.
            'unambiguously with "@username" or by using user PHIDs.',
            $identifier));
      }

      $list[] = head($users);
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Look the user up to get their current exact username, ID, or PHID (e.g. bin/user query or the People application)
  2. If renaming is suspected, resolve by PHID, which is stable across renames
  3. Remove the stale identifier from your script's list and re-run

Example fix

# before
$ bin/user edit --user alinciln ...

# after
$ bin/user edit --user alincoln ...
# or pin to the immutable PHID
$ bin/user edit --user PHID-USER-abcd1234 ...
Defensive patterns

Strategy: validation

Validate before calling

// Resolve identifiers before running the command; fail fast on misses.
$users = id(new PhabricatorUserQuery())
  ->setViewer(PhabricatorUser::getOmnipotentUser())
  ->withUsernames($identifiers)
  ->execute();
$missing = array_diff($identifiers, mpull($users, 'getUsername'));
if ($missing) {
  fwrite(STDERR, 'Unknown users: '.implode(', ', $missing)."\n");
  exit(1);
}

Try / catch

try { $list = $workflow->selectUsers($users, $identifiers); } catch (PhutilArgumentUsageException $ex) { /* print message; list valid usernames/PHIDs; exit 1 */ }

Prevention

When it happens

Trigger: Passing a typo'd or deleted username to --user; passing an ID of a user record that was deleted or never existed; passing a PHID with wrong type prefix or copy-paste error; the user exists but was disbled/renamed so the old username no longer matches.

Common situations: Offboarding scripts referencing removed users; renamed accounts breaking hardcoded usernames in maintenance scripts; copy-paste truncating a PHID.

Related errors


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