phacility/phabricator · info · PhutilArgumentUsageException

Use '%s' to specify the receiving object or email address.

Error message

Use '%s' to specify the receiving object or email address.

What it means

'bin/mail receive-test' simulates an inbound message, so it must know the destination: the --to flag (an object monogram like T123 or an application email address). The workflow checked $args->getArg('to') up front, found nothing, and halted with this PhutilArgumentUsageException before doing any work.

Source

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

            'param'   => 'object',
            'help'    => pht('Simulate mail delivery "To:" the given object.'),
          ),
          array(
            'name' => 'cc',
            'param' => 'address',
            'help' => pht('Simulate a mail delivery "Cc:" address.'),
            'repeat' => true,
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();
    $console = PhutilConsole::getConsole();

    $to = $args->getArg('to');
    if (!$to) {
      throw new PhutilArgumentUsageException(
        pht(
          "Use '%s' to specify the receiving object or email address.",
          '--to'));
    }

    $to_application_email = id(new PhabricatorMetaMTAApplicationEmailQuery())
      ->setViewer($this->getViewer())
      ->withAddresses(array($to))
      ->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))

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Re-run with --to, e.g. ./bin/mail receive-test --to T123 or --to reviews@example.com.
  2. Also supply the required acting user with --as <username> and pipe the raw message on stdin.
  3. See ./bin/mail help receive-test for the full flag list.

Example fix

# before
./bin/mail receive-test --as alincoln

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

Strategy: validation

Prevention

When it happens

Trigger: Running ./bin/mail receive-test without --to; passing the target under a different flag name (e.g. --recipient); scripts that build the command line and drop the flag.

Common situations: First-time use of the receive-test workflow; commands copy-pasted from docs or tickets with the flag stripped.

Related errors


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