{"record":{"id":"d02516a852e3e035","repo":"hibernate/hibernate-orm","slug":"right-operand-for-in-array-predicate-must-be-a-bas","errorCode":null,"errorMessage":"Right operand for in-array predicate must be a basic plural type expression, but found: {}","messagePattern":"Right operand for in-array predicate must be a basic plural type expression, but found: (.+?)","errorType":"exception","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":3440,"sourceCode":"\t\t\t\t\ttestExpression,\n\t\t\t\t\tcreateCollectionReferenceSubQuery(\n\t\t\t\t\t\t\tcollectionReferenceInListContext.simplePath(),\n\t\t\t\t\t\t\t(TerminalNode) collectionReferenceInListContext.collectionQuantifier().getChild(0).getChild(0)\n\t\t\t\t\t),\n\t\t\t\t\tnegated,\n\t\t\t\t\tnodeBuilder()\n\t\t\t);\n\t\t}\n\t\telse if ( inListContext instanceof HqlParser.ArrayInListContext arrayInListContext ) {\n\t\t\tif ( getCreationOptions().useStrictJpaCompliance() ) {\n\t\t\t\tthrow new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.HQL_COLLECTION_FUNCTION );\n\t\t\t}\n\n\t\t\tfinal var arrayExpr = (SqmExpression<?>) arrayInListContext.expression().accept( this );\n\t\t\tfinal var arrayExpressible = arrayExpr.getExpressible();\n\t\t\tif ( arrayExpressible != null ) {\n\t\t\t\tif ( !(arrayExpressible.getSqmType() instanceof BasicPluralType<?, ?> pluralType) ) {\n\t\t\t\t\tthrow new SemanticException(\n\t\t\t\t\t\t\t\"Right operand for in-array predicate must be a basic plural type expression, but found: \"\n\t\t\t\t\t\t\t\t+ arrayExpressible.getSqmType(),\n\t\t\t\t\t\t\tquery\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\ttestExpression.applyInferableType( pluralType.getElementType() );\n\t\t\t}\n\t\t\tfinal SelfRenderingSqmFunction<Boolean> contains = getFunctionDescriptor( \"array_contains\" ).generateSqmExpression(\n\t\t\t\t\tasList( arrayExpr, testExpression ),\n\t\t\t\t\tnull,\n\t\t\t\t\tqueryEngine()\n\t\t\t);\n\t\t\treturn new SqmBooleanExpressionPredicate( contains, negated, nodeBuilder() );\n\t\t}\n\t\telse {\n\t\t\tthrow new ParsingException( \"Unexpected IN predicate type [\" + ctx.getClass().getSimpleName() + \"] : \"\n\t\t\t\t\t+ ctx.getText() );\n\t\t}","sourceCodeStart":3422,"sourceCodeEnd":3458,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L3422-L3458","documentation":"Error \"Right operand for in-array predicate must be a basic plural type expression, but found: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A path expression of the wrong type is used in a collection predicate.","commonSituations":"Applying member of / is empty / includes / intersects / in-array to non-plural expressions.","solutions":["Use a basic plural expression as the right operand of the in-array predicate.","Pass an array/collection parameter of basic type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}