{"record":{"id":"f1310334293269c2","repo":"hibernate/hibernate-orm","slug":"path-ctx-path-resolved-to-pluralp","errorCode":null,"errorMessage":"Path '\" + ctx.path() + \"' resolved to '\" + pluralPath.getReferencedPathSource() + \"' which is not an indexed collection","messagePattern":"Path '\" \\+ ctx\\.path\\(\\) \\+ \"' resolved to '\" \\+ pluralPath\\.getReferencedPathSource\\(\\) \\+ \"' which is not an indexed collection","errorType":"exception","errorClass":"FunctionArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":5676,"sourceCode":"\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 );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new FunctionArgumentException( \"Path '\" + ctx.path()\n\t\t\t\t\t\t+  \"' resolved to '\"\n\t\t\t\t\t\t+ pluralPath.getReferencedPathSource()\n\t\t\t\t\t\t+ \"' which is not an indexed collection\" );\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// indices() and keys() 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\" );","sourceCodeStart":5658,"sourceCodeEnd":5694,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L5658-L5694","documentation":"Error \"Path '\" + ctx.path() + \"' resolved to '\" + pluralPath.getReferencedPathSource() + \"' which is not an indexed collection\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A collection-typed path is required but not found: Path '\" + ctx.path() + \"' resolved to '\" + pluralPath.getReferencedPathSource() + \"' which is not an indexed collection","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 resolves to a collection that is not indexed (neither list nor map). Index access requires a List or Map collection; use elements() or a join instead."],"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"}