phacility/phabricator · warning · PhutilArgumentUsageException

Use %s to select triggers by ID.

Error message

Use %s to select triggers by ID.

What it means

Thrown by `bin/worker trigger` management workflows when no `--id` flag is given. Trigger subcommands (execute, fire, etc.) operate on specific scheduled triggers, and unlike task workflows there is no class- or status-based selector: ID selection is the only mechanism, so an empty `--id` list is rejected immediately with this usage exception.

Source

Thrown at src/infrastructure/daemon/workers/management/PhabricatorWorkerTriggerManagementWorkflow.php:20

abstract class PhabricatorWorkerTriggerManagementWorkflow
  extends PhabricatorManagementWorkflow {

  protected function getTriggerSelectionArguments() {
    return array(
      array(
        'name' => 'id',
        'param' => 'id',
        'repeat' => true,
        'help' => pht('Select one or more triggers by ID.'),
      ),
    );
  }

  protected function loadTriggers(PhutilArgumentParser $args) {
    $ids = $args->getArg('id');
    if (!$ids) {
      throw new PhutilArgumentUsageException(
        pht('Use %s to select triggers by ID.', '--id'));
    }

    $triggers = id(new PhabricatorWorkerTriggerQuery())
      ->setViewer($this->getViewer())
      ->withIDs($ids)
      ->needEvents(true)
      ->execute();
    $triggers = mpull($triggers, null, 'getID');

    foreach ($ids as $id) {
      if (empty($triggers[$id])) {
        throw new PhutilArgumentUsageException(
          pht('No trigger exists with id "%s"!', $id));
      }
    }

    return $triggers;

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Add `--id <trigger-id>` (repeatable for multiple triggers)
  2. Find trigger IDs first via the database (`worker_trigger` table) or `phid.lookup`/search on the trigger PHID

Example fix

# before
./bin/worker trigger execute

# after
./bin/worker trigger execute --id 7
Defensive patterns

Strategy: validation

Validate before calling

if (empty($trigger_ids)) {
  throw new InvalidArgumentException(
    'Trigger workflows require at least one --id');
}
$cmd = './bin/worker trigger '.$subcommand;
foreach ($trigger_ids as $id) {
  $cmd .= ' --id '.(int)$id;
}

Prevention

When it happens

Trigger: Running `./bin/worker trigger execute` or `./bin/worker trigger fire` with no `--id` argument. Any trigger subcommand invocation that omits `--id` or passes it with an empty value.

Common situations: Operators used to `bin/worker task` commands assuming a `--class`-style filter exists; scripts that conditionally append `--id` and end up omitting it; exploratory runs expecting the command to list triggers.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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