{"record":{"id":"f96daba0824095cd","repo":"Intervention/image","slug":"unable-to-retrieve-unsupported-media-type-from-for","errorCode":null,"errorMessage":"Unable to retrieve unsupported media type from format","messagePattern":"Unable to retrieve unsupported media type from format","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Format.php","lineNumber":111,"sourceCode":"        return array_filter(\n            MediaType::cases(),\n            fn(MediaType $mediaType): bool => $mediaType->format() === $this,\n        );\n    }\n\n    /**\n     * Return the first found media type for the current format.\n     *\n     * @throws NotSupportedException\n     */\n    public function mediaType(): MediaType\n    {\n        $types = $this->mediaTypes();\n\n        $result = reset($types);\n\n        if (!$result instanceof MediaType) {\n            throw new NotSupportedException('Unable to retrieve unsupported media type from format');\n        }\n\n        return $result;\n    }\n\n    /**\n     * Return the possible file extension for the current format.\n     *\n     * @return array<FileExtension>\n     */\n    public function fileExtensions(): array\n    {\n        return array_filter(\n            FileExtension::cases(),\n            fn(FileExtension $fileExtension): bool => $fileExtension->format() === $this,\n        );\n    }\n","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Format.php#L93-L129","documentation":"Error \"Unable to retrieve unsupported media type from format\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Format.php:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Query mediaType() only on formats that define one; check the Format cases supported by your library version","Use Format::mediaTypes()/fileExtensions() helpers to inspect what a given format supports before calling","Upgrade the library if the format is listed in a newer version's media type map"],"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"}