Intervention/image · error · Intervention\Image\Exceptions\InvalidArgumentException
Unable to create format from "{$identifier}"
Error message
Unable to create format from "{$identifier}" What it means
Error "Unable to create format from "{$identifier}"" thrown in Intervention/image.
Source
Thrown at src/Format.php:64
if ($identifier instanceof self) {
return $identifier;
}
if ($identifier instanceof MediaType) {
return $identifier->format();
}
if ($identifier instanceof FileExtension) {
return $identifier->format();
}
try {
$format = MediaType::from(strtolower($identifier))->format();
} catch (Error) {
try {
$format = FileExtension::from(strtolower($identifier))->format();
} catch (Error) {
throw new InvalidArgumentException('Unable to create format from "' . $identifier . '"');
}
}
return $format;
}
/**
* Try to create format from given identifier and return null on failure.
*
* @param string|Format|MediaType|FileExtension $identifier
* @return Format|null
*/
public static function tryCreate(string|self|MediaType|FileExtension $identifier): ?self
{
try {
return self::create($identifier);
} catch (InvalidArgumentException) {
return null;View on GitHub (pinned to 5598b9e397)
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
When it happens
Trigger: Thrown at src/Format.php:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/e879e0d61a52b55f.
Report an issue: GitHub.