{"record":{"id":"1b947bf0f02b5724","repo":"Intervention/image","slug":"unable-to-read-size-of-stream","errorCode":null,"errorMessage":"Unable to read size of stream","messagePattern":"Unable to read size of stream","errorType":"exception","errorClass":"StreamException","httpStatus":null,"severity":"error","filePath":"src/File.php","lineNumber":162,"sourceCode":"            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');\n        }\n\n        return intval($info['size']);\n    }\n\n    /**\n     * {@inheritdoc}\n     *\n     * @see FileInterface::__toString()\n     *\n     * @throws StreamException\n     */\n    public function __toString(): string\n    {\n        return $this->toString();\n    }\n}\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/Intervention/image/blob/5598b9e39751c34afc5cdee84abef77f92c26f68/src/File.php#L144-L180","documentation":"Error \"Unable to read size of stream\" thrown in Intervention/image.","triggerScenarios":"Thrown at src/File.php:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an open, valid stream resource; fstat fails on closed or invalid handles","For streams without a size (pipes, sockets), buffer the contents into php://temp first and hand that stream over","Ensure the stream wrapper supports stat (some custom wrappers do not)"],"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"}