{"record":{"id":"207ed0a16ee186ae","repo":"phacility/phabricator","slug":"choose-which-capabilities-to-unlock-with-view","errorCode":null,"errorMessage":"Choose which capabilities to unlock with \"--view\", \"--edit\", or \"--owner\".","messagePattern":"Choose which capabilities to unlock with \"--view\", \"--edit\", or \"--owner\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php","lineNumber":80,"sourceCode":"    $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'));\n    $owner_user = $this->loadUser($args->getArg('owner'));\n\n    if (!$view_user && !$edit_user && !$owner_user) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Choose which capabilities to unlock with \"--view\", \"--edit\", '.\n          'or \"--owner\".'));\n    }\n\n    $handle = id(new PhabricatorHandleQuery())\n      ->setViewer($viewer)\n      ->withPHIDs(array($object->getPHID()))\n      ->executeOne();\n\n    echo tsprintf(\n      \"<bg:blue>** %s **</bg> %s\\n\",\n      pht('UNLOCKING'),\n      pht('Unlocking: %s', $handle->getFullName()));\n\n    $engine = PhabricatorUnlockEngine::newUnlockEngineForObject($object);\n\n    $xactions = array();","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php#L62-L98","documentation":"unlock needs at least one capability target: --view, --edit, or --owner, each taking a username. The three flags are loaded via loadUser(); if all resolve to null the workflow throws this usage exception before printing the policy table, because no change would be specified.","triggerScenarios":"Running ./bin/policy unlock T123 with none of --view, --edit, or --owner supplied.","commonSituations":"Using unlock to inspect policies (show is the right command) and forgetting the capability flags in incident scripts.","solutions":["Add at least one flag with a username: ./bin/policy unlock T123 --edit alice (flags combine, e.g. --view alice --edit bob).","To only read policies, use ./bin/policy show T123."],"exampleFix":"# before\n./bin/policy unlock T123\n# after\n./bin/policy unlock T123 --view alice --edit alice","handlingStrategy":"validation","validationCode":"case \" $* \" in\n  *' --view '*|*' --edit '*|*' --owner '*) ;;\n  *) echo 'unlock needs --view, --edit, or --owner' >&2; exit 64 ;;\nesac\nexec ./bin/policy unlock \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --view/--edit/--owner as required in scripts; the workflow refuses to run without one.","Use ./bin/policy show for read-only inspection."],"tags":["phabricator","cli","usage","unlock","options"],"backgroundTag":"cli-missing-option","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}