{"record":{"id":"c7ed7525cb19a6c4","repo":"phacility/phabricator","slug":"specify-the-type-of-key-to-generate-with-type","errorCode":null,"errorMessage":"Specify the type of key to generate with --type.","messagePattern":"Specify the type of key to generate with --type\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php","lineNumber":24,"sourceCode":"  protected function didConstruct() {\n    $this\n      ->setName('generate-key')\n      ->setSynopsis(\n        pht('Generate an encryption key.'))\n      ->setArguments(\n        array(\n          array(\n            'name' => 'type',\n            'param' => 'keytype',\n            'help' => pht('Select the type of key to generate.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $type = $args->getArg('type');\n    if (!strlen($type)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify the type of key to generate with --type.'));\n    }\n\n    $format = PhabricatorFileStorageFormat::getFormat($type);\n    if (!$format) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'No key type \"%s\" exists.',\n          $type));\n    }\n\n    if (!$format->canGenerateNewKeyMaterial()) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Storage format \"%s\" can not generate keys.',\n          $format->getStorageFormatName()));\n    }","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php#L6-L42","documentation":"CLI usage guard in the generate-key workflow: the --type argument is empty, so no key type was selected. A PhutilArgumentUsageException telling the operator to re-run the command with --type <keytype>.","triggerScenarios":"Thrown at src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run with --type specifying a key type (e.g. --type aes-256 or the install's format name)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","contentChangedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}