phacility/phabricator · warning · PhutilArgumentUsageException
Specify exactly one file to print, like "%s".
Error message
Specify exactly one file to print, like "%s".
What it means
The `./bin/files cat` workflow takes a single file name as its wildcard argument; passing more than one name is rejected as a usage error before anything is read. The message suggests the F123 monogram form. Each invocation prints exactly one file's bytes.
Source
Thrown at src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php:41
'name' => 'salvage',
'help' => pht(
'DANGEROUS. Attempt to salvage file content even if the '.
'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) {View on GitHub (pinned to 5720a38cfe)
Solutions
- Print one file per invocation, or loop in the shell: `for f in F123 F456; do ./bin/files cat "$f"; done`
- Quote arguments so a single name is passed unexpanded
Example fix
# before ./bin/files cat F123 F456 # after for f in F123 F456; do ./bin/files cat "$f"; done
Defensive patterns
Strategy: validation
Validate before calling
# In shell scripts, enforce the single-argument contract before invoking:
[ $# -eq 1 ] || { echo 'usage: dump.sh <file-monogram>' >&2; exit 2; }
./bin/files cat "$1" Prevention
- Quote file arguments so shell globs do not expand into multiple names
- Loop over names in the shell instead of passing several to one invocation
When it happens
Trigger: Running `./bin/files cat F123 F456`; passing a glob the shell expanded into multiple names.
Common situations: Scripting bulk extraction and assuming cat is variadic like `cat(1)`; unquoted shell globs expanding unexpectedly.
Related errors
- This storage format ("%s") does not support key selection.
- Specify a file to print, like "%s".
- Use --as <format> to select a target encoding format. Availa
- Storage format "%s" is not valid. Available formats are: %s.
- You must specify the path to a public keyfile with %s.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/d14e2002340b6290.
Report an issue: GitHub.