{"record":{"id":"cc704412abafda7e","repo":"phacility/phabricator","slug":"storage-format-s-is-not-valid-available-format","errorCode":null,"errorMessage":"Storage format \"%s\" is not valid. Available formats are: %s.","messagePattern":"Storage format \"(.+?)\" is not valid\\. Available formats are: (.+?)\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php","lineNumber":55,"sourceCode":"\n    $force = (bool)$args->getArg('force');\n\n    $format_list = PhabricatorFileStorageFormat::getAllFormats();\n    $format_list = array_keys($format_list);\n    $format_list = implode(', ', $format_list);\n\n    $format_key = $args->getArg('as');\n    if (!strlen($format_key)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Use --as <format> to select a target encoding format. Available '.\n          'formats are: %s.',\n          $format_list));\n    }\n\n    $format = PhabricatorFileStorageFormat::getFormat($format_key);\n    if (!$format) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Storage format \"%s\" is not valid. Available formats are: %s.',\n          $format_key,\n          $format_list));\n    }\n\n    $key_name = $args->getArg('key');\n    if (strlen($key_name)) {\n      $format->selectMasterKey($key_name);\n    }\n\n    $engines = PhabricatorFileStorageEngine::loadAllEngines();\n\n    $failed = array();\n    foreach ($iterator as $file) {\n      $monogram = $file->getMonogram();\n\n      $engine_key = $file->getStorageEngine();","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php#L37-L73","documentation":"The encode workflow resolves --as through PhabricatorFileStorageFormat::getFormat(), which maps registered FORMATKEY constants to classes; when the lookup misses, this usage error is thrown along with the list of available format keys. It means the requested format key is misspelled or its class is not loaded on this install.","triggerScenarios":"`--as aes-256` (missing -cbc), `--as AES-256-CBC` (case), or a module-provided format key on an install where that module is not enabled.","commonSituations":"Typos in scripts; referencing a custom storage format that exists only on another environment; formats renamed upstream.","solutions":["Copy a key exactly from the list printed in the error message (typically raw, test, aes-256-cbc plus module formats)","If a custom format was expected, enable the module/library that defines its class on this install and retry"],"exampleFix":"# before\n./bin/files encode --as aes-256 F123\n\n# after\n./bin/files encode --as aes-256-cbc F123","handlingStrategy":"validation","validationCode":"// Programmatic guard before running the workflow:\nif (PhabricatorFileStorageFormat::getFormat($format_key) === null) {\n  // \"{$format_key}\" is not registered here; pick from\n  // array_keys(PhabricatorFileStorageFormat::getAllFormats()).\n}","typeGuard":"function isValidStorageFormatKey($key) {\n  return array_key_exists($key, PhabricatorFileStorageFormat::getAllFormats());\n}","tryCatchPattern":null,"preventionTips":["Copy format keys verbatim from the error message's available-formats list","Source keys from FORMATKEY constants in scripts that build commands","Enable custom format modules on every install where encode runs"],"tags":["cli","usage","storage-format","files","phabricator"],"backgroundTag":"unknown-storage-format","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}