phacility/phabricator · error · PhutilArgumentUsageException

No such user "%s" exists.

Error message

No such user "%s" exists.

What it means

When bin/conduit call is given --as <username>, a PhabricatorPeopleQuery restricted with withUsernames() must resolve exactly one user; resolving none raises this PhutilArgumentUsageException naming the value passed. Without --as the call runs as the omnipotent viewer instead.

Source

Thrown at src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php:62

    if (!strlen($method)) {
      throw new PhutilArgumentUsageException(
        pht('Specify a method to call with "--method".'));
    }

    $input = $args->getArg('input');
    if (!strlen($input)) {
      throw new PhutilArgumentUsageException(
        pht('Specify a file to read parameters from with "--input".'));
    }

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

      // Allow inline generation of user caches for the user we're acting
      // as, since some calls may read user preferences.
      $actor->setAllowInlineCacheGeneration(true);
    } else {
      $actor = $viewer;
    }

    if ($input === '-') {
      fprintf(STDERR, tsprintf("%s\n", pht('Reading input from stdin...')));
      $input_json = file_get_contents('php://stdin');
    } else {
      $input_json = Filesystem::readFile($input);
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Look the exact username up in the People application (or via user.search) on that install and use it verbatim.
  2. Trim whitespace and check casing of the flag value.
  3. If you intended an administrative call, omit --as to execute as the omnipotent user.

Example fix

# before
$ ./bin/conduit call --method user.whoami --input p.json --as 'Alice Nguyen'
# after
$ ./bin/conduit call --method user.whoami --input p.json --as alice
Defensive patterns

Strategy: validation

Validate before calling

// Verify the username exists before running the command.
$actor = id(new PhabricatorPeopleQuery())
  ->setViewer(PhabricatorUser::getOmnipotentUser())
  ->withUsernames(array($as_user))
  ->executeOne();
if (!$actor) {
  throw new Exception(pht('Unknown user %s', $as_user));
}

Prevention

When it happens

Trigger: Passing --as alice when no user named alice exists; wrong casing/whitespace or a copy-pasted display name rather than the username; referencing a deleted or not-yet-created account.

Common situations: Scripts hardcoding a bot/admin username that differs per environment (e.g. 'ci-bot' vs 'ci_bot'); using the full name 'Alice Nguyen' where the username is 'alice'.

Related errors


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