Intervention/image · error · Intervention\Image\Exceptions\InvalidArgumentException
Unable to create file extension from "{$identifier}"
Error message
Unable to create file extension from "{$identifier}" What it means
Error "Unable to create file extension from "{$identifier}"" thrown in Intervention/image.
Source
Thrown at src/FileExtension.php:77
if ($identifier instanceof MediaType) {
try {
return $identifier->fileExtension();
} catch (NotSupportedException $e) {
throw new InvalidArgumentException(
'Unable to create file extension from "' . $identifier->value . '"',
previous: $e,
);
}
}
try {
$extension = self::from(strtolower($identifier));
} catch (Error) {
try {
$extension = MediaType::from(strtolower($identifier))->fileExtension();
} catch (Error | NotSupportedException) {
throw new InvalidArgumentException('Unable to create file extension from "' . $identifier . '"');
}
}
return $extension;
}
/**
* Try to create media type from given identifier and return null on failure.
*/
public static function tryCreate(string|self|Format|MediaType $identifier): ?self
{
try {
return self::create($identifier);
} catch (InvalidArgumentException) {
return null;
}
}
View on GitHub (pinned to 5598b9e397)
Solutions
- Pass a valid file extension or path such as "jpg", ".png" or "image.gif"
- Strip query strings or fragments from URLs before extracting the extension
- Match the extension against the library's supported formats; unknown extensions (e.g. ".foo") cannot be resolved
When it happens
Trigger: Thrown at src/FileExtension.php:77 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/615c5f354f8d80ba.
Report an issue: GitHub.