phacility/phabricator · error · PhutilArgumentUsageException

Specify a message to send with "--message".

Error message

Specify a message to send with "--message".

What it means

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.

Source

Thrown at src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php:49

        pht(
          'Specify a user to notify with "--user".'));
    }

    $user = id(new PhabricatorPeopleQuery())
      ->setViewer($viewer)
      ->withUsernames(array($username))
      ->executeOne();

    if (!$user) {
      throw new PhutilArgumentUsageException(
        pht(
          'No user with username "%s" exists.',
          $username));
    }

    $message = $args->getArg('message');
    if (!strlen($message)) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify a message to send with "--message".'));
    }

    $application_phid = id(new PhabricatorNotificationsApplication())
      ->getPHID();

    $content_source = $this->newContentSource();

    $xactions = array();

    $xactions[] = id(new PhabricatorUserTransaction())
      ->setTransactionType(
        PhabricatorUserNotifyTransaction::TRANSACTIONTYPE)
      ->setNewValue($message)
      ->setForceNotifyPHIDs(array($user->getPHID()));

    $editor = id(new PhabricatorUserTransactionEditor())

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Include a non-empty --message: ./bin/aphlict notify --user admin --message 'test ping'.
  2. In scripts, default the message: MSG="${MSG:-default notification text}".
  3. Skip the call entirely when the computed message is empty rather than invoking with ''.
Defensive patterns

Strategy: validation

Validate before calling

// Guard before invoking:
// MSG="${MSG:-default notification text}"
// [ -n "$MSG" ] && ./bin/aphlict notify --user "$USER" --message "$MSG"
if (!strlen($message)) {
  // skip sending rather than invoking with an empty --message
  return;
}

Try / catch

try {
  // execute notify workflow
} catch (PhutilArgumentUsageException $ex) {
  if (preg_match('/Specify a message to send/', $ex->getMessage())) {
    // Message source produced empty text: fix upstream, do not blind-retry.
  }
  throw $ex;
}

Prevention

When it happens

Trigger: Running the notify workflow with --user but without --message, or with --message '' (empty string), e.g. an unexpanded variable in automation.

Common situations: 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.

Related errors


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