{"record":{"id":"34df128775180031","repo":"Intervention/image","slug":"unable-to-create-media-type-from-identifier-clas","errorCode":null,"errorMessage":"Unable to create media type from {identifier::class}","messagePattern":"Unable to create media type from (.+?)","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/MediaType.php","lineNumber":61,"sourceCode":"    case IMAGE_X_ICON = 'image/x-icon';\n    case IMAGE_VND_MICROSOFT_ICON = 'image/vnd.microsoft.icon';\n\n    /**\n     * Create media type from given identifier.\n     *\n     * @throws InvalidArgumentException\n     */\n    public static function create(string|self|Format|FileExtension $identifier): self\n    {\n        if ($identifier instanceof self) {\n            return $identifier;\n        }\n\n        if ($identifier instanceof Format) {\n            try {\n                return $identifier->mediaType();\n            } catch (NotSupportedException $e) {\n                throw new InvalidArgumentException(\n                    'Unable to create media type from ' . $identifier::class,\n                    previous: $e,\n                );\n            }\n        }\n\n        if ($identifier instanceof FileExtension) {\n            try {\n                return $identifier->mediaType();\n            } catch (NotSupportedException $e) {\n                throw new InvalidArgumentException(\n                    'Unable to create media type from \"' . $identifier->value . '\"',\n                    previous: $e,\n                );\n            }\n        }\n\n        try {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/MediaType.php#L43-L79","documentation":"Error \"Unable to create media type from {identifier::class}\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/MediaType.php:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an identifier the MediaType factory understands: a media type string, Format/FileExtension enum, or file path","Check the object's class is mappable to a known media type; arbitrary objects are not supported","Convert the object to its media-type string (e.g. 'image/png') before calling"],"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"}