filamentphp/filament · error · LogicException

Constraint must be an instance of [{NumberConstraint::class}

Error message

Constraint must be an instance of [{NumberConstraint::class}].

What it means

Error "Constraint must be an instance of [{NumberConstraint::class}]." thrown in filamentphp/filament.

Source

Thrown at packages/query-builder/src/Constraints/NumberConstraint/Operators/Concerns/CanAggregateRelationships.php:164

    protected function getAttributeLabel(): string
    {
        $attributeLabel = $this->getConstraint()->getAttributeLabel();

        return __(match ($this->getAggregate()) {
            static::getAggregateAverageKey() => 'filament-query-builder::query-builder.operators.number.aggregates.average.summary',
            static::getAggregateMaxKey() => 'filament-query-builder::query-builder.operators.number.aggregates.max.summary',
            static::getAggregateMinKey() => 'filament-query-builder::query-builder.operators.number.aggregates.min.summary',
            static::getAggregateSumKey() => 'filament-query-builder::query-builder.operators.number.aggregates.sum.summary',
            default => $attributeLabel,
        }, ['attribute' => $attributeLabel]);
    }

    public function getConstraint(): ?NumberConstraint
    {
        $constraint = parent::getConstraint();

        if (! ($constraint instanceof NumberConstraint)) {
            throw new LogicException('Constraint must be an instance of [' . NumberConstraint::class . '].');
        }

        return $constraint;
    }
}

View on GitHub (pinned to 53483fa934)

When it happens

Trigger: Thrown at packages/query-builder/src/Constraints/NumberConstraint/Operators/Concerns/CanAggregateRelationships.php:164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of filamentphp/filament@53483fa934 (2026-08-17). Data as JSON: /api/errors/07845371f2b92e23. Report an issue: GitHub.