Intervention/image · error · InvalidArgumentException
The polygon must have at least 3 points
Error message
The polygon must have at least 3 points
What it means
Error "The polygon must have at least 3 points" thrown in Intervention/image.
Source
Thrown at src/Modifiers/DrawPolygonModifier.php:19
<?php
declare(strict_types=1);
namespace Intervention\Image\Modifiers;
use Intervention\Image\Exceptions\InvalidArgumentException;
use Intervention\Image\Geometry\Polygon;
use Intervention\Image\Interfaces\DrawableInterface;
class DrawPolygonModifier extends AbstractDrawModifier
{
/**
* @throws InvalidArgumentException
*/
public function __construct(public Polygon $drawable)
{
if ($drawable->count() < 3) {
throw new InvalidArgumentException('The polygon must have at least 3 points');
}
}
/**
* Return object to be drawn.
*/
protected function drawable(): DrawableInterface
{
return $this->drawable;
}
}
View on GitHub (pinned to 5598b9e397)
Solutions
- Provide at least 3 points when defining the polygon
- Build points with Intervention\Image\Geometry\Point instances, e.g. new Point(10, 20)
- Check dynamically built point arrays for dropped or null entries
When it happens
Trigger: Thrown at src/Modifiers/DrawPolygonModifier.php:19 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/96a467c5843aee2c.
Report an issue: GitHub.