phacility/phabricator · warning · PhutilArgumentUsageException

Specify the name of an object to show policy information for

Error message

Specify the name of an object to show policy information for.

What it means

bin/policy show prints the policies attached to exactly one object. The workflow reads the `objects` wildcard argument and throws this PhutilArgumentUsageException when the list is empty, before any query runs.

Source

Thrown at src/applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php:26

      ->setName('show')
      ->setSynopsis(pht('Show policy information about an object.'))
      ->setExamples('**show** D123')
      ->setArguments(
        array(
          array(
            'name'      => 'objects',
            'wildcard'  => true,
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $console = PhutilConsole::getConsole();
    $viewer = $this->getViewer();

    $obj_names = $args->getArg('objects');
    if (!$obj_names) {
      throw new PhutilArgumentUsageException(
        pht('Specify the name of an object to show policy information for.'));
    } else if (count($obj_names) > 1) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify the name of exactly one object to show policy information '.
          'for.'));
    }

    $object = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withNames($obj_names)
      ->executeOne();

    if (!$object) {
      $name = head($obj_names);
      throw new PhutilArgumentUsageException(
        pht(
          "No such object '%s'!",

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass one object name or monogram: ./bin/policy show T123
  2. If scripting, check the arguments before invoking and emit your own usage message.

Example fix

# before
./bin/policy show
# after
./bin/policy show T123
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/sh
[ "$#" -ge 1 ] || { echo 'usage: bin/policy show <object>' >&2; exit 64; }
exec ./bin/policy show "$@"

Prevention

When it happens

Trigger: Running ./bin/policy show with no arguments at all.

Common situations: Exploring the CLI, forgetting the argument inside cron or deployment scripts, and copy-pasting a truncated command line from docs.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/87c354f3ccddd1a1. Report an issue: GitHub.