{"record":{"id":"e879e0d61a52b55f","repo":"Intervention/image","slug":"unable-to-create-format-from-identifier","errorCode":null,"errorMessage":"Unable to create format from \"{$identifier}\"","messagePattern":"Unable to create format from \"(.+?)\"","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Format.php","lineNumber":64,"sourceCode":"        if ($identifier instanceof self) {\n            return $identifier;\n        }\n\n        if ($identifier instanceof MediaType) {\n            return $identifier->format();\n        }\n\n        if ($identifier instanceof FileExtension) {\n            return $identifier->format();\n        }\n\n        try {\n            $format = MediaType::from(strtolower($identifier))->format();\n        } catch (Error) {\n            try {\n                $format = FileExtension::from(strtolower($identifier))->format();\n            } catch (Error) {\n                throw new InvalidArgumentException('Unable to create format from \"' . $identifier . '\"');\n            }\n        }\n\n        return $format;\n    }\n\n    /**\n     * Try to create format from given identifier and return null on failure.\n     *\n     * @param string|Format|MediaType|FileExtension $identifier\n     * @return Format|null\n     */\n    public static function tryCreate(string|self|MediaType|FileExtension $identifier): ?self\n    {\n        try {\n            return self::create($identifier);\n        } catch (InvalidArgumentException) {\n            return null;","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Format.php#L46-L82","documentation":"Error \"Unable to create format from \"{$identifier}\"\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/Format.php:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a recognized identifier: a media type (\"image/jpeg\"), file extension (\"jpg\"), file path, or Format enum","Verify the format is one supported by Intervention\\Image: JPEG, PNG, GIF, WebP, AVIF, BMP, TIFF, HEIC","Normalize the identifier (lowercase, trim) before creating the Format"],"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"}