{"record":{"id":"bf286cca8065d85a","repo":"Intervention/image","slug":"unable-to-decode-from-empty-string","errorCode":null,"errorMessage":"Unable to decode from empty string","messagePattern":"Unable to decode from empty string","errorType":"exception","errorClass":"Intervention\\Image\\Exceptions\\InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/InputHandler.php","lineNumber":105,"sourceCode":"    }\n\n    /**\n     * {@inheritdoc}\n     *\n     * @see InputHandlerInterface::handle()\n     *\n     * @throws InvalidArgumentException\n     * @throws NotSupportedException\n     * @throws DriverException\n     */\n    public function handle(mixed $input): ImageInterface|ColorInterface\n    {\n        if ($input === null) {\n            throw new InvalidArgumentException('Unable to decode from null');\n        }\n\n        if ($input === '') {\n            throw new InvalidArgumentException('Unable to decode from empty string');\n        }\n\n        // if handler has only one single decoder run it can run directly\n        if (count($this->decoders) === 1) {\n            return $this->decoders()->current()->decode($input);\n        }\n\n        // multiple decoders: try to find the matching decoder for the input\n        foreach ($this->decoders() as $decoder) {\n            if ($decoder->supports($input)) {\n                return $decoder->decode($input);\n            }\n        }\n\n        throw new NotSupportedException('Unprocessable input');\n    }\n\n    /**","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/InputHandler.php#L87-L123","documentation":"Error \"Unable to decode from empty string\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/InputHandler.php:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the input string with empty() or strlen() before passing it to the decoder","Verify the source (HTTP body, file read) actually returned data before decoding","Return a 400-level response to clients that post empty image payloads"],"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"}