{"record":{"id":"034dd46ecf3f3bc5","repo":"phacility/phabricator","slug":"specify-a-user-to-notify-with-user","errorCode":null,"errorMessage":"Specify a user to notify with \"--user\".","messagePattern":"Specify a user to notify with \"--user\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php","lineNumber":30,"sourceCode":"          array(\n            'name' => 'user',\n            'param' => 'username',\n            'help' => pht('User to notify.'),\n          ),\n          array(\n            'name' => 'message',\n            'param' => 'text',\n            'help' => pht('Message to send.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $username = $args->getArg('user');\n    if (!strlen($username)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify a user to notify with \"--user\".'));\n    }\n\n    $user = id(new PhabricatorPeopleQuery())\n      ->setViewer($viewer)\n      ->withUsernames(array($username))\n      ->executeOne();\n\n    if (!$user) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'No user with username \"%s\" exists.',\n          $username));\n    }\n\n    $message = $args->getArg('message');\n    if (!strlen($message)) {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php#L12-L48","documentation":"Usage error from the Aphlict notify management workflow: the required --user argument was missing or empty. The check is strlen($username) on $args->getArg('user') before any user lookup, so Phabricator rejects the invocation immediately.","triggerScenarios":"Running ./bin/aphlict notify (or the notify workflow) without --user, or with --user '' because a shell variable expanded empty.","commonSituations":"Smoke-testing the notification server and forgetting the flag; scripts where $USERNAME_ARG is unset under set -u-less bash.","solutions":["Run with --user <username>, e.g. ./bin/aphlict notify --user admin --message 'hello'.","In scripts, assert the variable is non-empty before invoking.","Confirm the username is the account's exact username (case-sensitive lookup follows)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Shell guard:\n// [ -n \"$NOTIFY_USER\" ] || { echo 'error: --user is required' >&2; exit 1; }\n// PHP guard when composing the invocation:\nif (!strlen($username)) {\n  throw new Exception('Notify requires --user <username>.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  // execute notify workflow\n} catch (PhutilArgumentUsageException $ex) {\n  // Usage error: print message, exit 2; do not retry.\n  fwrite(STDERR, $ex->getMessage().\"\\n\");\n  exit(2);\n}","preventionTips":["Template notify commands with both flags always present: --user X --message Y.","Fail scripts early on empty variables instead of letting the CLI catch them.","Keep a one-line example in runbooks so operators copy a complete invocation."],"tags":["aphlict","notifications","cli","missing-argument","phabricator"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}