{"record":{"id":"4a8c53bac6ef9338","repo":"phacility/phabricator","slug":"specify-a-file-to-print-like-s","errorCode":null,"errorMessage":"Specify a file to print, like \"%s\".","messagePattern":"Specify a file to print, like \"(.+?)\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php","lineNumber":44,"sourceCode":"              'integrity check fails. If an adversary has tampered with '.\n              'the file, the content may be unsafe.'),\n          ),\n          array(\n            'name'      => 'names',\n            'wildcard'  => true,\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $console = PhutilConsole::getConsole();\n\n    $names = $args->getArg('names');\n    if (count($names) > 1) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify exactly one file to print, like \"%s\".', 'F123'));\n    } else if (!$names) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify a file to print, like \"%s\".', 'F123'));\n    }\n\n    $file = head($this->loadFilesWithNames($names));\n\n    $begin = $args->getArg('begin');\n    $end = $args->getArg('end');\n\n    $file->makeEphemeral();\n\n    // If we're running in \"salvage\" mode, wipe out any integrity hash which\n    // may be present. This makes us read file data without performing an\n    // integrity check.\n    $salvage = $args->getArg('salvage');\n    if ($salvage) {\n      $file->setIntegrityHash(null);\n    }\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php#L26-L62","documentation":"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.","triggerScenarios":"Running `./bin/files cat` with no arguments; a script variable that expanded to empty being passed as the name.","commonSituations":"Running the command from memory without a target; automation where the file-name variable is unset.","solutions":["Pass one file monogram or PHID: `./bin/files cat F123`","In scripts, check the variable is non-empty before invoking the workflow"],"exampleFix":"# before\n./bin/files cat\n\n# after\n./bin/files cat F123","handlingStrategy":"validation","validationCode":"# Guard against unset variables in automation:\n: \"${FILE_MONO:?specify a file monogram, e.g. F123}\"\n./bin/files cat \"$FILE_MONO\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass one file monogram (F123) or PHID","Set shell nounset (-u) so empty variables fail before reaching the workflow"],"tags":["cli","usage","files","phabricator"],"backgroundTag":"missing-required-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}