{"record":{"id":"a09524ac0b0adf56","repo":"phacility/phabricator","slug":"use-as-to-specify-the-acting-user","errorCode":null,"errorMessage":"Use '--as' to specify the acting user.","messagePattern":"Use '--as' to specify the acting user\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"info","filePath":"src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php","lineNumber":74,"sourceCode":"      ->executeOne();\n\n    $as = $args->getArg('as');\n    if (!$as && $to_application_email) {\n      $default_phid = $to_application_email->getConfigValue(\n        PhabricatorMetaMTAApplicationEmail::CONFIG_DEFAULT_AUTHOR);\n      if ($default_phid) {\n        $default_user = id(new PhabricatorPeopleQuery())\n          ->setViewer($this->getViewer())\n          ->withPHIDs(array($default_phid))\n          ->executeOne();\n        if ($default_user) {\n          $as = $default_user->getUsername();\n        }\n      }\n    }\n\n    if (!$as) {\n      throw new PhutilArgumentUsageException(\n        pht(\"Use '--as' to specify the acting user.\"));\n    }\n\n    $user = id(new PhabricatorPeopleQuery())\n      ->setViewer($this->getViewer())\n      ->withUsernames(array($as))\n      ->executeOne();\n    if (!$user) {\n      throw new PhutilArgumentUsageException(\n        pht(\"No such user '%s' exists.\", $as));\n    }\n\n\n    $from = $args->getArg('from');\n    if (!$from) {\n      $from = $user->loadPrimaryEmail()->getAddress();\n    }\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php#L56-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"Testing object-mail addressing (e.g. T123+user+hash@...) which always needs an explicit actor; first runs against a freshly configured application email.","solutions":["Add --as <username> of a real Phabricator user: ./bin/mail receive-test --to T123 --as alincoln.","If you want inference for an application address, configure the application email's default user so the workflow can pick it up.","Check ./bin/mail help receive-test for exact flag names."],"exampleFix":"# before\n./bin/mail receive-test --to T123\n\n# after\necho 'reply body' | ./bin/mail receive-test --to T123 --as alincoln","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --as when testing object monograms - inference only works for application emails with a default user.","Keep a documented one-liner with both flags for your install's inbound testing."],"tags":["phabricator","cli","mail","usage-error"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}