{"record":{"id":"63ab3a36adf339d0","repo":"phacility/phabricator","slug":"use-s-to-select-triggers-by-id","errorCode":null,"errorMessage":"Use %s to select triggers by ID.","messagePattern":"Use (.+?) to select triggers by ID\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/daemon/workers/management/PhabricatorWorkerTriggerManagementWorkflow.php","lineNumber":20,"sourceCode":"\nabstract class PhabricatorWorkerTriggerManagementWorkflow\n  extends PhabricatorManagementWorkflow {\n\n  protected function getTriggerSelectionArguments() {\n    return array(\n      array(\n        'name' => 'id',\n        'param' => 'id',\n        'repeat' => true,\n        'help' => pht('Select one or more triggers by ID.'),\n      ),\n    );\n  }\n\n  protected function loadTriggers(PhutilArgumentParser $args) {\n    $ids = $args->getArg('id');\n    if (!$ids) {\n      throw new PhutilArgumentUsageException(\n        pht('Use %s to select triggers by ID.', '--id'));\n    }\n\n    $triggers = id(new PhabricatorWorkerTriggerQuery())\n      ->setViewer($this->getViewer())\n      ->withIDs($ids)\n      ->needEvents(true)\n      ->execute();\n    $triggers = mpull($triggers, null, 'getID');\n\n    foreach ($ids as $id) {\n      if (empty($triggers[$id])) {\n        throw new PhutilArgumentUsageException(\n          pht('No trigger exists with id \"%s\"!', $id));\n      }\n    }\n\n    return $triggers;","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/workers/management/PhabricatorWorkerTriggerManagementWorkflow.php#L2-L38","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add `--id <trigger-id>` (repeatable for multiple triggers)","Find trigger IDs first via the database (`worker_trigger` table) or `phid.lookup`/search on the trigger PHID"],"exampleFix":"# before\n./bin/worker trigger execute\n\n# after\n./bin/worker trigger execute --id 7","handlingStrategy":"validation","validationCode":"if (empty($trigger_ids)) {\n  throw new InvalidArgumentException(\n    'Trigger workflows require at least one --id');\n}\n$cmd = './bin/worker trigger '.$subcommand;\nforeach ($trigger_ids as $id) {\n  $cmd .= ' --id '.(int)$id;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember trigger subcommands only select by --id; discover IDs from the worker_trigger table beforehand","Assert a non-empty ID list in automation before invoking the CLI"],"tags":["phabricator","cli","worker-trigger","missing-required-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}