{"record":{"id":"e0f67f08e2147075","repo":"phacility/phabricator","slug":"specify-a-resource-type-with-type","errorCode":null,"errorMessage":"Specify a resource type with \"--type\".","messagePattern":"Specify a resource type with \"--type\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/management/DrydockManagementLeaseWorkflow.php","lineNumber":49,"sourceCode":"            'param' => 'N',\n            'default' => 1,\n            'help' => pht('Lease a given number of identical resources.'),\n          ),\n          array(\n            'name' => 'blueprint',\n            'param' => 'identifier',\n            'repeat' => true,\n            'help' => pht('Lease resources from a specific blueprint.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $resource_type = $args->getArg('type');\n    if (!phutil_nonempty_string($resource_type)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify a resource type with \"--type\".'));\n    }\n\n    $until = $args->getArg('until');\n    if (phutil_nonempty_string($until)) {\n      $until = strtotime($until);\n      if ($until <= 0) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Unable to parse argument to \"--until\".'));\n      }\n    }\n\n    $count = $args->getArgAsInteger('count');\n    if ($count < 1) {\n      throw new PhutilArgumentUsageException(\n        pht(","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php#L31-L67","documentation":"A PhutilArgumentUsageException from `bin/drydock lease` when the --type flag is missing or empty. Every Drydock lease is created against a concrete resource type string (e.g. 'host', 'working-copy') which is later matched against blueprint implementations that can allocate it; without it the lease object cannot be constructed. The check uses phutil_nonempty_string(), so --type '' is rejected too.","triggerScenarios":"Running `bin/drydock lease` with no flags, or with --attributes/--count but an empty --type value; a script where $RESOURCE_TYPE is unset.","commonSituations":"First-time use of the CLI without reading the synopsis; shell scripts with unset variables under set -u disabled; renaming a resource type in automation without updating callers.","solutions":["Pass the resource type: `bin/drydock lease --type host`.","Use the exact type string your blueprints implement ('host', 'working-copy', or a custom type registered by a blueprint implementation)."],"exampleFix":"# before\nbin/drydock lease --count 2\n\n# after\nbin/drydock lease --type host --count 2","handlingStrategy":"validation","validationCode":"if (!phutil_nonempty_string($resource_type)) {\n  throw new InvalidArgumentException(\n    'Resource type is required (e.g. \"host\", \"working-copy\").');\n}","typeGuard":"function isKnownResourceType($type) {\n  $impls = DrydockBlueprintImplementation::getAllBlueprintImplementations();\n  foreach ($impls as $impl) {\n    if ($impl->getType() === $type) {\n      return true;\n    }\n  }\n  return false;\n}","tryCatchPattern":null,"preventionTips":["Define resource type strings as constants in one place instead of scattering literals through scripts.","Run `bin/drydock lease --help` when unsure of required flags."],"tags":["drydock","phabricator","cli","usage","resource-type"],"backgroundTag":"missing-cli-flag","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}