{"record":{"id":"16a198a49eda607a","repo":"phacility/phabricator","slug":"specify-exactly-one-buildable-by-object-name","errorCode":null,"errorMessage":"Specify exactly one buildable, by object name.","messagePattern":"Specify exactly one buildable, by object name\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/harbormaster/management/HarbormasterManagementUpdateWorkflow.php","lineNumber":44,"sourceCode":"            'help' => pht(\n              'If updating generates tasks, queue them for the daemons '.\n              'instead of executing them in this process.'),\n          ),\n          array(\n            'name'        => 'buildable',\n            'wildcard'    => true,\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $force_update = $args->getArg('force');\n\n    $names = $args->getArg('buildable');\n    if (count($names) != 1) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify exactly one buildable, by object name.'));\n    }\n\n    $buildable = id(new PhabricatorObjectQuery())\n      ->setViewer($viewer)\n      ->withNames($names)\n      ->executeOne();\n\n    if (!$buildable) {\n      throw new PhutilArgumentUsageException(\n        pht('No such buildable \"%s\"!', head($names)));\n    }\n\n    if (!($buildable instanceof HarbormasterBuildable)) {\n      throw new PhutilArgumentUsageException(\n        pht('Object \"%s\" is not a Harbormaster Buildable!', head($names)));\n    }\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/management/HarbormasterManagementUpdateWorkflow.php#L26-L62","documentation":"Usage exception from 'bin/harbormaster update'. This workflow advances the state machine of exactly one buildable, so the wildcard 'buildable' argument must contain exactly one object name (monogram or PHID). Zero names or more than one name fails this count check before any query runs.","triggerScenarios":"Running 'bin/harbormaster update' with no buildable argument, or 'bin/harbormaster update B1 B2' with two names.","commonSituations":"An unset variable in automation expands to zero arguments; looping over names but passing them all on one command line instead of one per invocation.","solutions":["Pass exactly one name: 'bin/harbormaster update B123'","For several buildables, loop the command once per name","In scripts, abort early when the name variable is empty instead of running the command"],"exampleFix":"# before\n$ bin/harbormaster update\n$ bin/harbormaster update B1 B2\n# after\n$ for b in B1 B2; do bin/harbormaster update \"$b\"; done","handlingStrategy":"validation","validationCode":"# shell wrapper: exactly one buildable name\nif [ $# -ne 1 ]; then\n  echo 'error: exactly one buildable name required' >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Loop once per buildable when updating several","Abort automation when the name variable is empty instead of running the command"],"tags":["harbormaster","phabricator","cli","argument-count","buildable"],"backgroundTag":"invalid-argument-count","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}