phacility/phabricator · info · PhutilArgumentUsageException

Use '--as' to specify the acting user.

Error message

Use '--as' to specify the acting user.

What it means

receive-test also needs an acting user. It only infers --as when --to resolved to an application email that has a default user configured; otherwise, with no --as given, it aborts with this usage hint before simulating delivery.

Source

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

      ->executeOne();

    $as = $args->getArg('as');
    if (!$as && $to_application_email) {
      $default_phid = $to_application_email->getConfigValue(
        PhabricatorMetaMTAApplicationEmail::CONFIG_DEFAULT_AUTHOR);
      if ($default_phid) {
        $default_user = id(new PhabricatorPeopleQuery())
          ->setViewer($this->getViewer())
          ->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();
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Add --as <username> of a real Phabricator user: ./bin/mail receive-test --to T123 --as alincoln.
  2. If you want inference for an application address, configure the application email's default user so the workflow can pick it up.
  3. Check ./bin/mail help receive-test for exact flag names.

Example fix

# before
./bin/mail receive-test --to T123

# after
echo 'reply body' | ./bin/mail receive-test --to T123 --as alincoln
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Omitting --as while --to is an object monogram (object receivers have no default sender); --to is an application email with no default user configured; misspelling the flag.

Common situations: Testing object-mail addressing (e.g. T123+user+hash@...) which always needs an explicit actor; first runs against a freshly configured application email.

Related errors


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