{"record":{"id":"9c8510e32daaae9c","repo":"phacility/phabricator","slug":"no-file-transform-with-key-s-exists","errorCode":null,"errorMessage":"No file transform with key \"%s\" exists.","messagePattern":"No file transform with key \"(.+?)\" exists\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/files/transform/PhabricatorFileTransform.php","lineNumber":43,"sourceCode":"    }\n\n    return $this->getDefaultTransform($file);\n  }\n\n  public static function getAllTransforms() {\n    return id(new PhutilClassMapQuery())\n      ->setAncestorClass(__CLASS__)\n      ->setExpandMethod('generateTransforms')\n      ->setUniqueMethod('getTransformKey')\n      ->execute();\n  }\n\n  public static function getTransformByKey($key) {\n    $all = self::getAllTransforms();\n\n    $xform = idx($all, $key);\n    if (!$xform) {\n      throw new Exception(\n        pht(\n          'No file transform with key \"%s\" exists.',\n          $key));\n    }\n\n    return $xform;\n  }\n\n}\n","sourceCodeStart":25,"sourceCodeEnd":53,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/files/transform/PhabricatorFileTransform.php#L25-L53","documentation":"PhabricatorFileTransform::getTransformByKey($key) looks the key up in the class-map of all registered transforms (built via getAllTransforms() with PhutilClassMapQuery, generateTransforms expansion, and getTransformKey() uniqueness). The given key matched nothing, so no such transform exists and the lookup throws rather than returning null.","triggerScenarios":"Calling PhabricatorFileTransform::getTransformByKey('profile-100x100') with a misspelled or outdated key; requesting a key only produced by generateTransforms() of a custom subclass that is not installed/enabled; a key renamed between Phabricator versions.","commonSituations":"Hard-coded transform keys in custom code or migrations that drift from the codebase after an upgrade; typos in configuration (e.g. a default-avatar transform setting); custom transform classes whose getTransformKey() changed or which fail to load due to a syntax error.","solutions":["List the valid keys and pick the right one: var_dump(array_keys(PhabricatorFileTransform::getAllTransforms()));","Fix typos/casing — keys are exact strings like 'thumb-140x140' or 'profile-100x100'.","If the key should come from a custom subclass, verify the class extends PhabricatorFileTransform, is loadable, and its getTransformKey() matches; check for uniqueness collisions silently dropping it."],"exampleFix":"// before\n$xform = PhabricatorFileTransform::getTransformByKey('thumbnail-140');\n\n// after\n$xform = PhabricatorFileTransform::getTransformByKey('thumb-140x140');","handlingStrategy":"type-guard","validationCode":"$all = PhabricatorFileTransform::getAllTransforms();\nif (idx($all, $key) === null) {\n  // unknown key: log and use a safe default instead of throwing\n  $key = 'thumb-140x140';\n}\n$xform = PhabricatorFileTransform::getTransformByKey($key);","typeGuard":"function isValidTransformKey(string $key): bool {\n  return idx(PhabricatorFileTransform::getAllTransforms(), $key) !== null;\n}","tryCatchPattern":"try {\n  $xform = PhabricatorFileTransform::getTransformByKey($key);\n} catch (Exception $ex) {\n  $xform = PhabricatorFileTransform::getTransformByKey('thumb-140x140');\n}","preventionTips":["Never hard-code transform keys blindly — enumerate them via getAllTransforms() and assert membership in a test.","After upgrading Phabricator, re-check that keys your code references still exist.","For custom transforms, unit-test getTransformKey() so renames are caught at CI time."],"tags":["phabricator","image-transform","lookup","php"],"backgroundTag":"unknown-key-lookup","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}