{"record":{"id":"bc79dc693a7af4a3","repo":"hibernate/hibernate-orm","slug":"path-ctx-path-gettext-did-not-resolv","errorCode":null,"errorMessage":"Path '\" + ctx.path().getText() + \"' did not resolve to a many-valued attribute","messagePattern":"Path '\" \\+ ctx\\.path\\(\\)\\.getText\\(\\) \\+ \"' did not resolve to a many-valued attribute","errorType":"exception","errorClass":"FunctionArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":5655,"sourceCode":"\t\t// the actual function name might be 'minelement' or 'maxelement', so trim it\n\t\tfinal String functionName = ctx.getChild(0).getText().substring(0, 3);\n\n\t\tfinal var path = consumePluralAttributeReference( ctx.path() );\n\t\tif ( path instanceof SqmPluralValuedSimplePath<?> pluralPath ) {\n\t\t\treturn new SqmElementAggregateFunction<>( pluralPath, functionName );\n\t\t}\n\t\telse {\n\t\t\t// elements() and values() and only apply to compound paths\n\t\t\tif ( path instanceof SqmMapJoin ) {\n\t\t\t\tthrow new FunctionArgumentException( \"Path '\" + ctx.path().getText()\n\t\t\t\t\t\t+ \"' resolved to a joined map instead of a compound path\" );\n\t\t\t}\n\t\t\telse if ( path instanceof SqmListJoin ) {\n\t\t\t\tthrow new FunctionArgumentException( \"Path '\" + ctx.path().getText()\n\t\t\t\t\t\t+ \"' resolved to a joined list instead of a compound path\" );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new FunctionArgumentException( \"Path '\" + ctx.path().getText()\n\t\t\t\t\t\t+ \"' did not resolve to a many-valued attribute\" );\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic SqmExpression<?> visitIndexAggregateFunction(HqlParser.IndexAggregateFunctionContext ctx) {\n\t\tif ( creationOptions.useStrictJpaCompliance() ) {\n\t\t\tthrow new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.HQL_COLLECTION_FUNCTION );\n\t\t}\n\n\t\t// the actual function name might be 'minindex' or 'maxindex', so trim it\n\t\tfinal String functionName = ctx.getChild(0).getText().substring(0, 3);\n\n\t\tfinal var path = consumePluralAttributeReference( ctx.path() );\n\t\tif ( path instanceof SqmPluralValuedSimplePath<?> pluralPath ) {\n\t\t\tif ( isIndexedPluralAttribute( pluralPath ) ) {\n\t\t\t\treturn new SqmIndexAggregateFunction<>( pluralPath, functionName );","sourceCodeStart":5637,"sourceCodeEnd":5673,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L5637-L5673","documentation":"Error \"Path '\" + ctx.path().getText() + \"' did not resolve to a many-valued attribute\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A collection-typed path is required but not found: Path '\" + ctx.path().getText() + \"' did not resolve to a many-valued attribute","commonSituations":"Applying collection operations (elements/indices/key/value/index, slice, member of) to singular paths, or to joined lists/maps that are not compound/indexed paths.","solutions":["The path used with the index/collection operation does not resolve to a many-valued (collection) attribute. Verify the path points to a collection-valued association."],"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"}