{"record":{"id":"035afc08f136ac3d","repo":"phacility/phabricator","slug":"specify-the-name-of-exactly-one-object-to-show-pol","errorCode":null,"errorMessage":"Specify the name of exactly one object to show policy information for.","messagePattern":"Specify the name of exactly one object to show policy information for\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php","lineNumber":29,"sourceCode":"      ->setArguments(\n        array(\n          array(\n            'name'      => 'objects',\n            'wildcard'  => true,\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $console = PhutilConsole::getConsole();\n    $viewer = $this->getViewer();\n\n    $obj_names = $args->getArg('objects');\n    if (!$obj_names) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify the name of an object to show policy information for.'));\n    } else if (count($obj_names) > 1) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify the name of exactly one object to show policy information '.\n          'for.'));\n    }\n\n    $object = id(new PhabricatorObjectQuery())\n      ->setViewer($viewer)\n      ->withNames($obj_names)\n      ->executeOne();\n\n    if (!$object) {\n      $name = head($obj_names);\n      throw new PhutilArgumentUsageException(\n        pht(\n          \"No such object '%s'!\",\n          $name));\n    }\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php#L11-L47","documentation":"Usage guard in the policy 'show' CLI workflow: fires when more than one object name was passed. The command displays policy details for exactly one object, so after the first name is accepted any extras abort the run with this arity check.","triggerScenarios":"Running ./bin/policy show T1 T2 with two or more names, often via a shell glob that matched several objects.","commonSituations":"Globbing monograms in scripts and pasting several names expecting batch output.","solutions":["Invoke the command once per object, passing exactly one name each time."],"exampleFix":"# before\n./bin/policy show T1 T2\n# after\n./bin/policy show T1 && ./bin/policy show T2","handlingStrategy":"validation","validationCode":"#!/bin/sh\n[ \"$#\" -eq 1 ] || { echo 'pass exactly one object name' >&2; exit 64; }\nexec ./bin/policy show \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote and count expanded globs before passing them as object names.","Loop over candidates and call the workflow once per name."],"tags":["phabricator","cli","usage","arguments"],"backgroundTag":"too-many-cli-arguments","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","contentChangedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}