phacility/phabricator · error · PhutilArgumentUsageException

No such user with username "%s"!

Error message

No such user with username "%s"!

What it means

Thrown by the audit delete workflow's loadUsers() when one of the usernames passed via --users does not match any Phabricator user. All requested usernames are resolved via PhabricatorPeopleQuery; each missing name aborts the run before any deletion happens.

Source

Thrown at src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php:244

    return 0;
  }

  private function loadUsers($users) {
    $users = $this->parseList($users);
    if (!$users) {
      return null;
    }

    $objects = id(new PhabricatorPeopleQuery())
      ->setViewer($this->getViewer())
      ->withUsernames($users)
      ->execute();
    $objects = mpull($objects, null, 'getUsername');

    foreach ($users as $name) {
      if (empty($objects[$name])) {
        throw new PhutilArgumentUsageException(
          pht('No such user with username "%s"!', $name));
      }
    }

    return $objects;
  }

  private function parseList($list) {
    $list = preg_split('/\s*,\s*/', $list);

    foreach ($list as $key => $item) {
      $list[$key] = trim($item);
    }

    foreach ($list as $key => $item) {
      if (!strlen($item)) {
        unset($list[$key]);
      }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Verify the exact username: bin/user query bob (or search in People) and copy-paste it into --users
  2. Remove ex-users from the list if their audit data no longer needs deletion
  3. Usernames are case-sensitive here — match the stored casing exactly

Example fix

# before
$ bin/audit delete --users alice,b0b
# after
$ bin/audit delete --users alice,bob --dry-run
Defensive patterns

Strategy: validation

Validate before calling

$objects = id(new PhabricatorPeopleQuery())
  ->setViewer($viewer)
  ->withUsernames($names)
  ->execute();
$found = mpull($objects, null, 'getUsername');
foreach ($names as $name) {
  if (empty($found[$name])) {
    throw new InvalidArgumentException("Unknown username '{$name}'");
  }
}

Prevention

When it happens

Trigger: --users alice,bob where 'bob' has a typo (b0b), was renamed, or was deleted/disabled; case mismatch against the stored username.

Common situations: Retyping usernames by hand instead of copying them; running the command long after a user left and their account was renamed or removed; scripts with hard-coded user lists drifting out of date.

Related errors


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