{"record":{"id":"85f1f48aa1e2d7eb","repo":"hibernate/hibernate-orm","slug":"argument-s-of-s-function-is-not-a-plural-p","errorCode":null,"errorMessage":"Argument '%s' of '%s()' function is not a plural path ","messagePattern":"Argument '(.+?)' of '(.+?)\\(\\)' function is not a plural path ","errorType":"exception","errorClass":"FunctionArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":1496,"sourceCode":"\t\t\tfinal var collectionFunctionMisuse = functionExpression.function().collectionFunctionMisuse();\n\t\t\tif ( collectionFunctionMisuse != null ) {\n\t\t\t\treturn visitCollectionFunctionSelection( collectionFunctionMisuse );\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprivate SqmPluralPartSelectionPath<?> visitCollectionFunctionSelection(\n\t\t\tHqlParser.CollectionFunctionMisuseContext ctx) {\n\t\tif ( getCreationOptions().useStrictJpaCompliance() ) {\n\t\t\tthrow new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.HQL_COLLECTION_FUNCTION );\n\t\t}\n\n\t\tfinal var pluralAttributePath = consumeDomainPath( ctx.path() );\n\t\tfinal var firstNode = (TerminalNode) ctx.getChild( 0 ).getChild( 0 );\n\n\t\tif ( !( pluralAttributePath.getReferencedPathSource() instanceof PluralPersistentAttribute<?, ?, ?> ) ) {\n\t\t\tthrow new FunctionArgumentException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\"Argument '%s' of '%s()' function is not a plural path \",\n\t\t\t\t\t\t\tpluralAttributePath.getNavigablePath(),\n\t\t\t\t\t\t\tfirstNode.getSymbol().getText()\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn new SqmPluralPartSelectionPath<>(\n\t\t\t\t(SqmPluralValuedSimplePath<?>) pluralAttributePath,\n\t\t\t\tcollectionFunctionNature( firstNode )\n\t\t);\n\t}\n\n\t@Override\n\tpublic SqmDynamicInstantiation<?> visitInstantiation(HqlParser.InstantiationContext ctx) {\n\t\tfinal var dynamicInstantiation = visitInstantiationTarget( ctx.instantiationTarget() );\n\t\tfor ( var arg : ctx.instantiationArguments().instantiationArgument() ) {","sourceCodeStart":1478,"sourceCodeEnd":1514,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L1478-L1514","documentation":"Error \"Argument '%s' of '%s()' function is not a plural path \" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Pass a plural (collection-valued) path to the collection function.","Check that the argument is a mapped collection attribute."],"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"}