phacility/phabricator · warning · PhutilArgumentUsageException

Specify a file to print, like "%s".

Error message

Specify a file to print, like "%s".

What it means

The `./bin/files cat` workflow requires exactly one file name argument; this variant is thrown when none was supplied (empty wildcard). It is a pure command-line usage error raised before any file lookup happens.

Source

Thrown at src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php:44

              'integrity check fails. If an adversary has tampered with '.
              'the file, the content may be unsafe.'),
          ),
          array(
            'name'      => 'names',
            'wildcard'  => true,
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $console = PhutilConsole::getConsole();

    $names = $args->getArg('names');
    if (count($names) > 1) {
      throw new PhutilArgumentUsageException(
        pht('Specify exactly one file to print, like "%s".', 'F123'));
    } else if (!$names) {
      throw new PhutilArgumentUsageException(
        pht('Specify a file to print, like "%s".', 'F123'));
    }

    $file = head($this->loadFilesWithNames($names));

    $begin = $args->getArg('begin');
    $end = $args->getArg('end');

    $file->makeEphemeral();

    // If we're running in "salvage" mode, wipe out any integrity hash which
    // may be present. This makes us read file data without performing an
    // integrity check.
    $salvage = $args->getArg('salvage');
    if ($salvage) {
      $file->setIntegrityHash(null);
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass one file monogram or PHID: `./bin/files cat F123`
  2. In scripts, check the variable is non-empty before invoking the workflow

Example fix

# before
./bin/files cat

# after
./bin/files cat F123
Defensive patterns

Strategy: validation

Validate before calling

# Guard against unset variables in automation:
: "${FILE_MONO:?specify a file monogram, e.g. F123}"
./bin/files cat "$FILE_MONO"

Prevention

When it happens

Trigger: Running `./bin/files cat` with no arguments; a script variable that expanded to empty being passed as the name.

Common situations: Running the command from memory without a target; automation where the file-name variable is unset.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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