Intervention/image · error · Intervention\Image\Exceptions\InvalidArgumentException
Height of {$this::class} must be greater than or equal to 0
Error message
Height of {$this::class} must be greater than or equal to 0 What it means
Error "Height of {$this::class} must be greater than or equal to 0" thrown in Intervention/image.
Source
Thrown at src/Geometry/Rectangle.php:40
{
/**
* Create new rectangle.
*
* @throws InvalidArgumentException
*/
public function __construct(
int $width,
int $height,
protected PointInterface $pivot = new Point(),
) {
if ($width < 0) {
throw new InvalidArgumentException(
'Width of ' . $this::class . ' must be greater than or equal to 0',
);
}
if ($height < 0) {
throw new InvalidArgumentException(
'Height of ' . $this::class . ' must be greater than or equal to 0',
);
}
parent::__construct([
new Point(0, 0),
new Point($width, 0),
new Point($width, $height * -1),
new Point(0, $height * -1),
], $pivot);
}
/**
* Create rectangle statically.
*
* @deprecated Use Intervention\Image\Size::class instead.
*
* @throws InvalidArgumentExceptionView on GitHub (pinned to 5598b9e397)
Solutions
- Pass a height of 0 or more when constructing the Rectangle
- Clamp negative computed heights with max(0, $height) before constructing the object
- Validate user input that feeds the height so negative values are rejected early
When it happens
Trigger: Thrown at src/Geometry/Rectangle.php:40 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/0756e4a1f7d7758c.
Report an issue: GitHub.