{"record":{"id":"0285ce0d1788b27f","repo":"phacility/phabricator","slug":"specify-the-name-of-exactly-one-object-to-unlock","errorCode":null,"errorMessage":"Specify the name of exactly one object to unlock.","messagePattern":"Specify the name of exactly one object to unlock\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php","lineNumber":58,"sourceCode":"            'help' => pht(\n              'Change the owner of an object to the specified user.'),\n          ),\n          array(\n            'name' => 'objects',\n            'wildcard' => true,\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $object_names = $args->getArg('objects');\n    if (!$object_names) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify the name of an object to unlock.'));\n    } else if (count($object_names) > 1) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify the name of exactly one object to unlock.'));\n    }\n\n    $object_name = head($object_names);\n\n    $object = id(new PhabricatorObjectQuery())\n      ->setViewer($viewer)\n      ->withNames(array($object_name))\n      ->executeOne();\n    if (!$object) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Unable to find any object with the specified name (\"%s\").',\n          $object_name));\n    }\n\n    $view_user = $this->loadUser($args->getArg('view'));\n    $edit_user = $this->loadUser($args->getArg('edit'));","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php#L40-L76","documentation":"The unlock workflow processes one object per invocation; passing two or more names (count($object_names) > 1) throws this usage exception immediately after the empty check.","triggerScenarios":"Running ./bin/policy unlock T1 T2, or a shell glob expanding to several monograms.","commonSituations":"Batch rescue attempts that must be split into one call per object.","solutions":["Run the command once per object with exactly one name, then add the --view/--edit/--owner flags."],"exampleFix":"# before\n./bin/policy unlock T1 T2 --edit alice\n# after\n./bin/policy unlock T1 --edit alice && ./bin/policy unlock T2 --edit alice","handlingStrategy":"validation","validationCode":"#!/bin/sh\nobjs=\"$1\"; shift\n[ -n \"$objs\" ] && [ $# -eq 0 ] || { echo 'exactly one object name allowed' >&2; exit 64; }\nexec ./bin/policy unlock \"$objs\" \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Batch rescues must loop: one invocation per object.","Avoid unquoted globs that expand to several monograms."],"tags":["phabricator","cli","usage","arguments","unlock"],"backgroundTag":"cli-too-many-arguments","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}