{"record":{"id":"d9132ca5678c2694","repo":"Intervention/image","slug":"unable-to-create-media-type-from-identifier-val","errorCode":null,"errorMessage":"Unable to create media type from \"{identifier->value}\"","messagePattern":"Unable to create media type from \"(.+?)\"","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/MediaType.php","lineNumber":72,"sourceCode":"            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 {\n            $type = self::from(strtolower($identifier));\n        } catch (Error) {\n            try {\n                $type = FileExtension::from(strtolower($identifier))->mediaType();\n            } catch (Error | NotSupportedException) {\n                throw new InvalidArgumentException('Unable to create media type from \"' . $identifier . '\"');\n            }\n        }\n\n        return $type;\n    }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/MediaType.php#L54-L90","documentation":"Error \"Unable to create media type from \"{identifier->value}\"\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/MediaType.php:72 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a backed enum value that maps to a supported media type, e.g. Format::PNG->value","Verify the media type string matches an entry like 'image/jpeg', 'image/png', 'image/gif', 'image/webp', 'image/avif', 'image/bmp', 'image/tiff', 'image/heic'","Normalize casing and whitespace of the identifier before resolution"],"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"}