Intervention/image · error · StreamException
Unable to read size of stream
Error message
Unable to read size of stream
What it means
Error "Unable to read size of stream" thrown in Intervention/image.
Source
Thrown at src/File.php:162
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');
}
return intval($info['size']);
}
/**
* {@inheritdoc}
*
* @see FileInterface::__toString()
*
* @throws StreamException
*/
public function __toString(): string
{
return $this->toString();
}
}
View on GitHub (pinned to 5598b9e397)
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)
When it happens
Trigger: Thrown at src/File.php:162 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/1b947bf0f02b5724.
Report an issue: GitHub.