{"record":{"id":"6777a18b8faef5b6","repo":"phacility/phabricator","slug":"no-file-storage-format-with-key-s-exists","errorCode":null,"errorMessage":"No file storage format with key \"%s\" exists.","messagePattern":"No file storage format with key \"(.+?)\" exists\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/format/PhabricatorFileStorageFormat.php","lineNumber":76,"sourceCode":"  }\n\n  final public static function getAllFormats() {\n    return id(new PhutilClassMapQuery())\n      ->setAncestorClass(__CLASS__)\n      ->setUniqueMethod('getStorageFormatKey')\n      ->execute();\n  }\n\n  final public static function getFormat($key) {\n    $formats = self::getAllFormats();\n    return idx($formats, $key);\n  }\n\n  final public static function requireFormat($key) {\n    $format = self::getFormat($key);\n\n    if (!$format) {\n      throw new Exception(\n        pht(\n          'No file storage format with key \"%s\" exists.',\n          $key));\n    }\n\n    return $format;\n  }\n\n}\n","sourceCodeStart":58,"sourceCodeEnd":86,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/format/PhabricatorFileStorageFormat.php#L58-L86","documentation":"PhabricatorFileStorageFormat::requireFormat() throws when no storage format class is registered under the given format key. Format keys are FORMATKEY class constants discovered via PhutilClassMapQuery, so an unknown key means a typo or a format class that is not loaded (disabled module, removed custom class). Reads and writes of files can both route through this lookup.","triggerScenarios":"Calling PhabricatorFileStorageFormat::requireFormat('aes-256-bcb') with a typo; files.default-format set to a key with no matching class; loading a file row whose storage format references a custom format class that is no longer enabled on this install.","commonSituations":"Renaming or deleting a custom storage format class while old files still reference its key; typo'd config values; moving a database to an install that lacks the extension providing the format.","solutions":["List registered keys and fix the typo: var_dump(array_keys(PhabricatorFileStorageFormat::getAllFormats())) — expected keys include 'raw', 'test', 'aes-256-cbc'","If old files reference a removed custom format, restore or re-enable that class (e.g. via a Phabricator module) so the key resolves again","Correct files.default-format to a key that exists on this install"],"exampleFix":"// before\n$format = PhabricatorFileStorageFormat::requireFormat('aes-256-cbc-256');\n\n// after\n$format = PhabricatorFileStorageFormat::requireFormat('aes-256-cbc');","handlingStrategy":"validation","validationCode":"// Soft-resolve before requiring:\nif (PhabricatorFileStorageFormat::getFormat($format_key) === null) {\n  // Unknown format key: choose from the registered set instead of letting\n  // requireFormat() throw mid-request.\n  $valid = implode(', ', array_keys(PhabricatorFileStorageFormat::getAllFormats()));\n  throw new Exception(\"Unknown storage format '{$format_key}'. Valid: {$valid}\");\n}","typeGuard":"function isValidStorageFormatKey($key) {\n  return array_key_exists($key, PhabricatorFileStorageFormat::getAllFormats());\n}","tryCatchPattern":null,"preventionTips":["Derive format keys from class constants, e.g. PhabricatorFileAES256StorageFormat::FORMATKEY, instead of string literals","Keep custom storage format classes enabled on every install that holds files referencing their keys","Add a deploy-time check that files.default-format resolves via getFormat()"],"tags":["storage-format","config","php","phabricator"],"backgroundTag":"unknown-storage-format","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}