Intervention/image · error · StreamException
Failed to rewind stream
Error message
Failed to rewind stream
What it means
Error "Failed to rewind stream" thrown in Intervention/image.
Source
Thrown at src/File.php:144
throw new StreamException('Unable to read data from stream');
}
return $data;
}
/**
* {@inheritdoc}
*
* @see FileInterface::toStream()
*
* @throws StreamException
*/
public function toStream()
{
$rewind = rewind($this->stream);
if ($rewind === false) {
throw new StreamException('Failed to rewind stream');
}
return $this->stream;
}
/**
* {@inheritdoc}
*
* @see FileInterface::size()
*
* @throws StreamException
*/
public function size(): int
{
$info = fstat($this->toStream());
if (!is_array($info)) {
throw new StreamException('Unable to read size of stream');View on GitHub (pinned to 5598b9e397)
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
When it happens
Trigger: Thrown at src/File.php:144 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Intervention/image@5598b9e397 (2026-08-23).
Data as JSON: /api/errors/ac4161736a4503d3.
Report an issue: GitHub.