{"record":{"id":"01eeb9fb97b7901b","repo":"phacility/phabricator","slug":"use-flags-to-specify-at-least-one-edit-to-apply-to","errorCode":null,"errorMessage":"Use flags to specify at least one edit to apply to the rule (for example, use \"--disable\" to disable a rule).","messagePattern":"Use flags to specify at least one edit to apply to the rule \\(for example, use \"--disable\" to disable a rule\\)\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/herald/management/HeraldRuleManagementWorkflow.php","lineNumber":74,"sourceCode":"    }\n\n    $is_disable = $args->getArg('disable');\n    $is_enable = $args->getArg('enable');\n\n    $xactions = array();\n\n    if ($is_disable && $is_enable) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify \"--enable\" or \"--disable\", but not both.'));\n    } else if ($is_disable || $is_enable) {\n      $xactions[] = $rule->getApplicationTransactionTemplate()\n        ->setTransactionType(HeraldRuleDisableTransaction::TRANSACTIONTYPE)\n        ->setNewValue($is_disable);\n    }\n\n    if (!$xactions) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Use flags to specify at least one edit to apply to the '.\n          'rule (for example, use \"--disable\" to disable a rule).'));\n    }\n\n    $herald_phid = id(new PhabricatorHeraldApplication())->getPHID();\n\n    $editor = $rule->getApplicationTransactionEditor()\n      ->setActor($viewer)\n      ->setActingAsPHID($herald_phid)\n      ->setContentSource($this->newContentSource())\n      ->setContinueOnMissingFields(true)\n      ->setContinueOnNoEffect(true);\n\n    echo tsprintf(\n      \"%s\\n\",\n      pht(\n        'Applying changes to %s: %s...',","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/herald/management/HeraldRuleManagementWorkflow.php#L56-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add at least one edit flag, most commonly --disable or --enable: bin/herald rule --rule H123 --disable.","To just inspect a rule, use the web UI (/herald/view/123/) or a Conduit 'herald.rule.query' call instead of this editing workflow.","Run 'bin/herald help rule' to enumerate the accepted edit flags."],"exampleFix":"# before\nbin/herald rule --rule H123\n\n# after\nbin/herald rule --rule H123 --disable","handlingStrategy":"validation","validationCode":"// Compute intended edits first; refuse empty edit sets up front\n$wants_edit = $args->getArg('disable') || $args->getArg('enable');\nif (!$wants_edit) {\n  // print 'nothing to do; pass --disable or --enable' and exit 2\n}","typeGuard":null,"tryCatchPattern":"try {\n  $workflow->execute($args);\n} catch (PhutilArgumentUsageException $ex) {\n  // 'at least one edit' -> no side effects occurred; add a flag and retry\n}","preventionTips":["Treat this workflow as write-only; use the web UI or Conduit for read/inspect operations.","Script wrappers should assert at least one edit flag before shelling out."],"tags":["herald","phabricator","cli","usage-error","missing-argument"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}