{"record":{"id":"9bfe03e3de29e2ee","repo":"phacility/phabricator","slug":"use-id-or-active-to-select-builds","errorCode":null,"errorMessage":"Use \"--id\" or \"--active\" to select builds.","messagePattern":"Use \"--id\" or \"--active\" to select builds\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/harbormaster/management/HarbormasterManagementRestartWorkflow.php","lineNumber":34,"sourceCode":"            'name' => 'id',\n            'param' => 'id',\n            'repeat' => true,\n            'help' => pht('Select one or more builds by ID.'),\n          ),\n          array(\n            'name' => 'active',\n            'help' => pht('Select all active builds.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n    $ids = $args->getArg('id');\n    $active = $args->getArg('active');\n\n    if (!$ids && !$active) {\n      throw new PhutilArgumentUsageException(\n        pht('Use \"--id\" or \"--active\" to select builds.'));\n    } if ($ids && $active) {\n      throw new PhutilArgumentUsageException(\n        pht('Use one of \"--id\" or \"--active\" to select builds, but not both.'));\n    }\n\n    $query = id(new HarbormasterBuildQuery())\n      ->setViewer($viewer);\n    if ($ids) {\n      $query->withIDs($ids);\n    } else {\n      $query->withBuildStatuses(\n        HarbormasterBuildStatus::getActiveStatusConstants());\n    }\n    $builds = $query->execute();\n\n    $count = count($builds);\n    if (!$count) {","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/management/HarbormasterManagementRestartWorkflow.php#L16-L52","documentation":"Usage exception from 'bin/harbormaster restart'. The command must be told which builds to restart: specific builds via one or more --id flags, or every currently active build via --active. With neither selection the command has no target set, so it aborts rather than doing nothing.","triggerScenarios":"Running 'bin/harbormaster restart' with no arguments.","commonSituations":"An operator forgets the flags; an automation script expands an empty list variable so no --id is passed.","solutions":["Restart specific builds: 'bin/harbormaster restart --id 15 --id 16'","Restart every active build: 'bin/harbormaster restart --active'","Find build IDs from the build page URI (/build/15/ means --id 15)"],"exampleFix":"# before\n$ bin/harbormaster restart\n# after\n$ bin/harbormaster restart --active","handlingStrategy":"validation","validationCode":"# shell wrapper before invoking restart\nif [ -z ${BUILD_IDS:-} ] && [ ${RESTART_ACTIVE:-0} -eq 0 ]; then\n  echo 'error: pass --id <id> or --active' >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use --active for bulk maintenance and --id for targeted restarts; never neither","Require at least one selection flag in automation wrappers"],"tags":["harbormaster","phabricator","cli","missing-option","build-restart"],"backgroundTag":"missing-required-option","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}