phacility/phabricator · error · PhutilArgumentUsageException

No such user '%s' exists.

Error message

No such user '%s' exists.

What it means

A --as value was supplied, but PhabricatorPeopleQuery->withUsernames(array($as))->executeOne() found no user with that exact username, so the workflow aborts before simulating delivery. The lookup matches the username string only - not email, not display name, not PHID.

Source

Thrown at src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php:83

          ->withPHIDs(array($default_phid))
          ->executeOne();
        if ($default_user) {
          $as = $default_user->getUsername();
        }
      }
    }

    if (!$as) {
      throw new PhutilArgumentUsageException(
        pht("Use '--as' to specify the acting user."));
    }

    $user = id(new PhabricatorPeopleQuery())
      ->setViewer($this->getViewer())
      ->withUsernames(array($as))
      ->executeOne();
    if (!$user) {
      throw new PhutilArgumentUsageException(
        pht("No such user '%s' exists.", $as));
    }


    $from = $args->getArg('from');
    if (!$from) {
      $from = $user->loadPrimaryEmail()->getAddress();
    }

    $cc = $args->getArg('cc');

    $console->writeErr("%s\n", pht('Reading message body from stdin...'));
    $body = file_get_contents('php://stdin');

    $received = new PhabricatorMetaMTAReceivedMail();
    $header_content = array(
      'Message-ID' => Filesystem::readRandomCharacters(12),
      'From'       => $from,

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use the exact stored username (case included): ./bin/mail receive-test --to T123 --as alincoln.
  2. Look the username up in the People application (or People query) if unsure; do not pass the email address.
  3. If the user was renamed, update your script to the new username.

Example fix

# before (display name / email)
./bin/mail receive-test --to T123 --as 'abraham.lincoln@example.com'

# after (exact username)
./bin/mail receive-test --to T123 --as alincoln
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the acting user by username before building the command.
$user = id(new PhabricatorPeopleQuery())
  ->setViewer($admin)
  ->withUsernames(array($as))
  ->executeOne();
if (!$user) {
  // pick a real username instead of failing inside receive-test
}

Prevention

When it happens

Trigger: Passing a typo'd username, a user who was renamed or deleted, an email address, or a display name ('Abraham Lincoln') instead of the username ('alincoln') to --as.

Common situations: Copy-pasting from the UI where display names are shown; renamed users; scripts carrying stale usernames.

Related errors


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