{"record":{"id":"ac4161736a4503d3","repo":"Intervention/image","slug":"failed-to-rewind-stream","errorCode":null,"errorMessage":"Failed to rewind stream","messagePattern":"Failed to rewind stream","errorType":"exception","errorClass":"StreamException","httpStatus":null,"severity":"error","filePath":"src/File.php","lineNumber":144,"sourceCode":"            throw new StreamException('Unable to read data from stream');\n        }\n\n        return $data;\n    }\n\n    /**\n     * {@inheritdoc}\n     *\n     * @see FileInterface::toStream()\n     *\n     * @throws StreamException\n     */\n    public function toStream()\n    {\n        $rewind = rewind($this->stream);\n\n        if ($rewind === false) {\n            throw new StreamException('Failed to rewind stream');\n        }\n\n        return $this->stream;\n    }\n\n    /**\n     * {@inheritdoc}\n     *\n     * @see FileInterface::size()\n     *\n     * @throws StreamException\n     */\n    public function size(): int\n    {\n        $info = fstat($this->toStream());\n\n        if (!is_array($info)) {\n            throw new StreamException('Unable to read size of stream');","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/File.php#L126-L162","documentation":"Error \"Failed to rewind stream\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/File.php:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a seekable stream (e.g. php://temp or a local file) instead of a non-seekable one like php://stdin or a network stream","Check stream_get_meta_data()['seekable'] before operations that require rewinding","Re-open the stream if it was closed or detached before the rewind call"],"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"}