phacility/phabricator · warning · PhutilArgumentUsageException

Use flags to specify at least one edit to apply to the rule

Error message

Use flags to specify at least one edit to apply to the rule (for example, use "--disable" to disable a rule).

What it means

PhutilArgumentUsageException thrown by HeraldRuleManagementWorkflow when no edit flags were supplied, so the accumulated $xactions list is empty. The workflow only supports flag-driven edits (--enable/--disable, plus any other flags defined), and refuses to open an editor or perform a no-op save.

Source

Thrown at src/applications/herald/management/HeraldRuleManagementWorkflow.php:74

    }

    $is_disable = $args->getArg('disable');
    $is_enable = $args->getArg('enable');

    $xactions = array();

    if ($is_disable && $is_enable) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify "--enable" or "--disable", but not both.'));
    } else if ($is_disable || $is_enable) {
      $xactions[] = $rule->getApplicationTransactionTemplate()
        ->setTransactionType(HeraldRuleDisableTransaction::TRANSACTIONTYPE)
        ->setNewValue($is_disable);
    }

    if (!$xactions) {
      throw new PhutilArgumentUsageException(
        pht(
          'Use flags to specify at least one edit to apply to the '.
          'rule (for example, use "--disable" to disable a rule).'));
    }

    $herald_phid = id(new PhabricatorHeraldApplication())->getPHID();

    $editor = $rule->getApplicationTransactionEditor()
      ->setActor($viewer)
      ->setActingAsPHID($herald_phid)
      ->setContentSource($this->newContentSource())
      ->setContinueOnMissingFields(true)
      ->setContinueOnNoEffect(true);

    echo tsprintf(
      "%s\n",
      pht(
        'Applying changes to %s: %s...',

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Add at least one edit flag, most commonly --disable or --enable: bin/herald rule --rule H123 --disable.
  2. To just inspect a rule, use the web UI (/herald/view/123/) or a Conduit 'herald.rule.query' call instead of this editing workflow.
  3. Run 'bin/herald help rule' to enumerate the accepted edit flags.

Example fix

# before
bin/herald rule --rule H123

# after
bin/herald rule --rule H123 --disable
Defensive patterns

Strategy: validation

Validate before calling

// Compute intended edits first; refuse empty edit sets up front
$wants_edit = $args->getArg('disable') || $args->getArg('enable');
if (!$wants_edit) {
  // print 'nothing to do; pass --disable or --enable' and exit 2
}

Try / catch

try {
  $workflow->execute($args);
} catch (PhutilArgumentUsageException $ex) {
  // 'at least one edit' -> no side effects occurred; add a flag and retry
}

Prevention

When it happens

Trigger: Running 'bin/herald rule --rule H123' with no further flags: --rule alone only selects the rule; every supported edit is expressed as a flag, and none was given, so there is nothing to apply.

Common situations: Operators expect the command to print rule details or open an interactive editor; scripts probe with a bare --rule call first; users forget the edit flag after a copy-paste from docs that showed the generic form.

Related errors


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