{"record":{"id":"9be964eb7e701520","repo":"phacility/phabricator","slug":"use-s-to-specify-a-build-plan-to-run","errorCode":null,"errorMessage":"Use %s to specify a build plan to run.","messagePattern":"Use (.+?) to specify a build plan to run\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php","lineNumber":58,"sourceCode":"    $name = head($names);\n\n    $buildable = id(new PhabricatorObjectQuery())\n      ->setViewer($viewer)\n      ->withNames($names)\n      ->executeOne();\n    if (!$buildable) {\n      throw new PhutilArgumentUsageException(\n        pht('No such buildable \"%s\"!', $name));\n    }\n\n    if (!($buildable instanceof HarbormasterBuildableInterface)) {\n      throw new PhutilArgumentUsageException(\n        pht('Object \"%s\" is not a buildable!', $name));\n    }\n\n    $plan_id = $args->getArg('plan');\n    if (!$plan_id) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Use %s to specify a build plan to run.',\n          '--plan'));\n    }\n\n    $plan = id(new HarbormasterBuildPlanQuery())\n      ->setViewer($viewer)\n      ->withIDs(array($plan_id))\n      ->executeOne();\n    if (!$plan) {\n      throw new PhutilArgumentUsageException(\n        pht('Build plan \"%s\" does not exist.', $plan_id));\n    }\n\n    if (!$plan->canRunManually()) {\n      throw new PhutilArgumentUsageException(\n        pht('This build plan can not be run manually.'));\n    }","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php#L40-L76","documentation":"Usage error from `harbormaster build`: after a valid buildable is resolved, a build plan must be chosen with --plan. The message explicitly names the missing flag.","triggerScenarios":"Running `harbormaster build D123` with no --plan; supplying the plan as a positional argument instead of a flag; a wrapper dropping the flag.","commonSituations":"First-time use; scripts adapted from the UI flow where the plan is chosen interactively.","solutions":["Add the flag with a plan ID: `--plan 5` (numeric ID from the plan URI /harbormaster/plan/5/).","List plans in the UI (Build > Build Plans) to get the ID if unsure."],"exampleFix":"# before\n./bin/phabricator harbormaster build D123\n\n# after\n./bin/phabricator harbormaster build --plan 5 D123","handlingStrategy":"validation","validationCode":"if (empty($args['plan'])) {\n  fwrite(STDERR, \"Use --plan to specify a build plan to run.\\n\");\n  exit(64);\n}","typeGuard":null,"tryCatchPattern":"try {\n  runBuildWorkflow($args);\n} catch (PhutilArgumentUsageException $e) {\n  fwrite(STDERR, $e->getMessage().\"\\n\");\n  exit(64);\n}","preventionTips":["Standardize on a wrapper that always passes --plan <id> <object> and validates both before exec."],"tags":["harbormaster","cli","usage-error","build-plan"],"backgroundTag":"cli-argument-validation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}