hibernate/hibernate-orm · error · IllegalArgumentException
The predicate array cannot be null
Error message
The predicate array cannot be null
What it means
Error "The predicate array cannot be null" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/tree/spi/select/SqmQuerySpec.java:391
@Override
public SqmQuerySpec<T> setRestriction(BooleanExpression... restrictions) {
if ( restrictions.length == 0 ) {
setWhereClause( null );
}
else {
SqmWhereClause whereClause = getWhereClause();
if ( whereClause == null ) {
setWhereClause( whereClause = new SqmWhereClause( nodeBuilder() ) );
}
whereClause.setPredicate( nodeBuilder().wrap( restrictions ) );
}
return this;
}
@Nonnull
public SqmQuerySpec<T> setRestriction(@Nullable Predicate... restrictions) {
if ( restrictions == null ) {
throw new IllegalArgumentException( "The predicate array cannot be null" );
}
else if ( restrictions.length == 0 ) {
setWhereClause( null );
}
else {
final var whereClause = resetWhereClause();
for ( var restriction : restrictions ) {
whereClause.applyPredicate( (SqmPredicate) restriction );
}
}
return this;
}
@Nonnull
@Override
public SqmQuerySpec<T> setRestriction(List<Predicate> restrictions) {
if ( restrictions == null ) {
throw new IllegalArgumentException( "The predicate list cannot be null" );View on GitHub (pinned to fad1729dce)
Solutions
- Pass a non-null array of predicates; use an empty array if no restriction is needed, or skip the call entirely.
- Check for null before calling and guard the call site.
When it happens
Trigger: A restriction method is invoked with a null Predicate array (varargs) on a criteria query specification.
Common situations: Passing a null Predicate[] variable to where()/having(); check for null before the call.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/5fb001ad0b177741.
Report an issue: GitHub.