{"record":{"id":"57ca5cc009554f53","repo":"Intervention/image","slug":"intervention-image-encodedimage-contains-unsupport","errorCode":null,"errorMessage":"Intervention\\Image\\EncodedImage contains unsupported image type","messagePattern":"Intervention\\\\Image\\\\EncodedImage contains unsupported image type","errorType":"exception","errorClass":"ImageDecoderException","httpStatus":null,"severity":"error","filePath":"src/Drivers/Gd/Decoders/EncodedImageObjectDecoder.php","lineNumber":49,"sourceCode":"     *\n     * @see DecoderInterface::decode()\n     *\n     * @throws InvalidArgumentException\n     * @throws ImageDecoderException\n     * @throws DriverException\n     * @throws StateException\n     * @throws NotSupportedException\n     */\n    public function decode(mixed $input): ImageInterface\n    {\n        if (!$input instanceof EncodedImageInterface) {\n            throw new InvalidArgumentException('Image source must be of type ' . EncodedImage::class);\n        }\n\n        try {\n            return parent::decode($input->toString());\n        } catch (DecoderException) {\n            throw new ImageDecoderException(EncodedImage::class . ' contains unsupported image type');\n        }\n    }\n}\n","sourceCodeStart":31,"sourceCodeEnd":53,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/Drivers/Gd/Decoders/EncodedImageObjectDecoder.php#L31-L53","documentation":"EncodedImageObjectDecoder::decode accepted the EncodedImage object, but decoding its ->toString() binary payload through the parent binary chain raised a DecoderException. The wrapped bytes are not an image the GD driver can decode — unsupported format, corrupt data, or truncated content — so an ImageDecoderException with this message is thrown.","triggerScenarios":"ImageManager::read(new EncodedImage($bytes, 'image/tiff')) with TIFF/HEIC/SVG/ICO bytes on the GD driver; EncodedImage objects rebuilt from queue payloads whose binary was damaged in transit; encoded images produced by another driver/version and replayed against GD; empty byte payloads in the value object.","commonSituations":"Queue/job systems serializing EncodedImage objects (or their raw parts) between workers with different GD capabilities; multi-format ingest pipelines where TIFF/HEIC sneak in; cached encode results from v2 being re-decoded by v3; payloads that were JSON-escaped and lost bytes.","solutions":["Inspect the payload: $encodedImage->toString(), check strlen and magic bytes, and try getimagesizefromstring on it","Switch the reading manager to ImagickDriver for TIFF/HEIC/JP2-class content, or pre-convert the bytes to PNG/JPEG","Re-create the EncodedImage from a verified source file instead of a possibly damaged serialized copy","Catch ImageDecoderException in the worker and dead-letter the job with the failing payload attached for inspection"],"exampleFix":"// before\n$image = $manager->read(new EncodedImage($tiffBytes, 'image/tiff'));\n// ImageDecoderException: Intervention\\Image\\EncodedImage contains unsupported image type\n\n// after\n$imagickManager = new \\Intervention\\Image\\ImageManager(new \\Intervention\\Image\\Drivers\\Imagick\\Driver());\n$image = $imagickManager->read(new EncodedImage($tiffBytes, 'image/tiff'));","handlingStrategy":"try-catch","validationCode":"$bytes = $encodedImage->toString();\nif ($bytes === '' || @getimagesizefromstring($bytes) === false) {\n    throw new RuntimeException('EncodedImage payload is not GD-decodable; convert or use Imagick');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $image = $manager->read($encodedImage);\n} catch (\\Intervention\\Image\\Exceptions\\ImageDecoderException $e) {\n    // wrapped bytes unsupported on GD; dead-letter the job and inspect payload\n}","preventionTips":["Verify serialized payloads survived transport (lengths/checksums) in queue workers","Standardize on GD-supported formats before creating EncodedImage objects","Run workers and web tier with the same GD/Imagick capabilities"],"tags":["encoded-image","unsupported-format","decoder","gd-driver","queue"],"backgroundTag":"unsupported-image-format","analyzedSha":"5598b9e39751c34afc5cdee84abef77f92c26f68","analyzedAt":"2026-08-23T02:17:31.068Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}