{"record":{"id":"5966d9abfef9ce93","repo":"phacility/phabricator","slug":"specify-a-message-to-send-with-message","errorCode":null,"errorMessage":"Specify a message to send with \"--message\".","messagePattern":"Specify a message to send with \"--message\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php","lineNumber":49,"sourceCode":"        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)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify a message to send with \"--message\".'));\n    }\n\n    $application_phid = id(new PhabricatorNotificationsApplication())\n      ->getPHID();\n\n    $content_source = $this->newContentSource();\n\n    $xactions = array();\n\n    $xactions[] = id(new PhabricatorUserTransaction())\n      ->setTransactionType(\n        PhabricatorUserNotifyTransaction::TRANSACTIONTYPE)\n      ->setNewValue($message)\n      ->setForceNotifyPHIDs(array($user->getPHID()));\n\n    $editor = id(new PhabricatorUserTransactionEditor())","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php#L31-L67","documentation":"Usage error from the Aphlict notify workflow: --message was omitted or empty. The check strlen($message) runs after the target user resolved successfully, and the workflow refuses to send an empty notification.","triggerScenarios":"Running the notify workflow with --user but without --message, or with --message '' (empty string), e.g. an unexpanded variable in automation.","commonSituations":"Smoke-test commands that only pass --user; scripts building the message from a variable that is empty when a log file has no new lines.","solutions":["Include a non-empty --message: ./bin/aphlict notify --user admin --message 'test ping'.","In scripts, default the message: MSG=\"${MSG:-default notification text}\".","Skip the call entirely when the computed message is empty rather than invoking with ''."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Guard before invoking:\n// MSG=\"${MSG:-default notification text}\"\n// [ -n \"$MSG\" ] && ./bin/aphlict notify --user \"$USER\" --message \"$MSG\"\nif (!strlen($message)) {\n  // skip sending rather than invoking with an empty --message\n  return;\n}","typeGuard":null,"tryCatchPattern":"try {\n  // execute notify workflow\n} catch (PhutilArgumentUsageException $ex) {\n  if (preg_match('/Specify a message to send/', $ex->getMessage())) {\n    // Message source produced empty text: fix upstream, do not blind-retry.\n  }\n  throw $ex;\n}","preventionTips":["Default or assert non-empty message text in scripts before calling notify.","Skip the notification when the computed message is empty (e.g. no new log lines).","Treat an empty message as a data problem upstream, not a CLI problem."],"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"}