{"record":{"id":"ee7793d9fdbb2496","repo":"Intervention/image","slug":"unable-to-create-file-extension-from-identifier","errorCode":null,"errorMessage":"Unable to create file extension from \"{$identifier::class}\"","messagePattern":"Unable to create file extension from \"(.+?)\"","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/FileExtension.php","lineNumber":53,"sourceCode":"    case JXL = 'jxl';\n    case ICO = 'ico';\n\n    /**\n     * Create file extension from given identifier.\n     *\n     * @throws InvalidArgumentException\n     */\n    public static function create(string|self|Format|MediaType $identifier): self\n    {\n        if ($identifier instanceof self) {\n            return $identifier;\n        }\n\n        if ($identifier instanceof Format) {\n            try {\n                return $identifier->fileExtension();\n            } catch (NotSupportedException $e) {\n                throw new InvalidArgumentException(\n                    'Unable to create file extension from \"' . $identifier::class . '\"',\n                    previous: $e,\n                );\n            }\n        }\n\n        if ($identifier instanceof MediaType) {\n            try {\n                return $identifier->fileExtension();\n            } catch (NotSupportedException $e) {\n                throw new InvalidArgumentException(\n                    'Unable to create file extension from \"' . $identifier->value . '\"',\n                    previous: $e,\n                );\n            }\n        }\n\n        try {","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/FileExtension.php#L35-L71","documentation":"Error \"Unable to create file extension from \"{$identifier::class}\"\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/FileExtension.php:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a supported identifier: a file path string, a Format/FileExtension enum, or an object mappable to a known extension","Check the given object's class against the formats supported by Intervention\\Image (JPEG, PNG, GIF, WebP, AVIF, BMP, TIFF, HEIC)","Use FileExtension::tryFrom() or Format lookups when the identifier type is dynamic"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}