Intervention/image · error · InvalidArgumentException
No decoders in array
Error message
No decoders in array
What it means
AbstractDriver::decodeImage() requires a non-empty list of image input decoders. When no explicit list is passed it uses the built-in InputHandler::IMAGE_DECODERS chain, so this exception can only fire when a custom decoders array was passed and it is empty.
Source
Thrown at src/Drivers/AbstractDriver.php:59
{
return $this->config;
}
/**
* {@inheritdoc}
*
* @see DriverInterface::decodeImage()
*
* @throws InvalidArgumentException
* @throws ImageDecoderException
* @throws DriverException
*/
public function decodeImage(mixed $input, ?array $decoders = null): ImageInterface
{
$decoders = $decoders === null ? InputHandler::IMAGE_DECODERS : $decoders;
if (count($decoders) === 0) {
throw new InvalidArgumentException('No decoders in array');
}
try {
$result = InputHandler::usingDecoders($decoders, $this)->handle($input);
} catch (NotSupportedException) {
$type = is_object($input) ? $input::class : gettype($input);
throw new InvalidArgumentException('Unsupported image source type "' . $type . '"');
}
if (!$result instanceof ImageInterface) {
throw new ImageDecoderException('Result must be instance of ' . ImageInterface::class);
}
return $result;
}
/**
* {@inheritdoc}View on GitHub (pinned to 5598b9e397)
Solutions
- Pass null to use the default decoder chain
- Ensure a dynamically built decoder array is non-empty before calling decodeImage()
Example fix
// before
$decoders = array_filter($all, fn ($d) => $d->supportsStreaming());
$image = $driver->decodeImage($input, array_values($decoders)); // may be []
// after
$image = $decoders === []
? $driver->decodeImage($input)
: $driver->decodeImage($input, array_values($decoders)); Defensive patterns
Strategy: validation
Validate before calling
if ($decoders === []) {
$decoders = null; // fall back to the default chain
}
$image = $driver->decodeImage($input, $decoders); Prevention
- Never pass a possibly-empty custom decoder array; pass null instead
- Assert count($decoders) > 0 after runtime filtering
When it happens
Trigger: Calling $driver->decodeImage($input, []) with an explicitly empty decoders array, e.g. a dynamically filtered list that removed every decoder.
Common situations: Apps building custom decoder chains by filtering InputHandler::IMAGE_DECODERS at runtime (e.g. disabling file-path decoding) and accidentally filtering everything.
Related errors
- Result must be instance of {ImageInterface::class}
- Invalid $limit value. Must be int<1, max>
- Call to undefined method Intervention\Image\Image::{name}()
- Hex color has an incorrect length
- Failed to decode hex color
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/73a6b1e562bdeb8e.
Report an issue: GitHub.