hibernate/hibernate-orm · error · FunctionArgumentException

The set-returning from node '%s' does not specify an index/o

Error message

The set-returning from node '%s' does not specify an index/ordinality

What it means

Error "The set-returning from node '%s' does not specify an index/ordinality" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:6058

		final boolean madeNested;
		if ( consumer instanceof QualifiedJoinPathConsumer qualifiedJoinPathConsumer ) {
			madeNested = !qualifiedJoinPathConsumer.isNested();
			if ( madeNested ) {
				qualifiedJoinPathConsumer.setNested( true );
			}
		}
		else {
			madeNested = false;
		}
		final var sqmPath = consumeDomainPath( ctx.path() );
		final boolean hasContinuation = ctx.getChildCount() == 5;

		final var referencedPathSource = sqmPath.getReferencedPathSource();
		final var firstNode = (TerminalNode) ctx.indexKeyQuantifier().getChild( 0 );
		if ( firstNode.getSymbol().getType() == HqlParser.INDEX
				&& referencedPathSource instanceof AnonymousTupleType<?> tupleType ) {
			if ( tupleType.findSubPathSource( CollectionPart.Nature.INDEX.getName() ) == null ) {
				throw new FunctionArgumentException(
						String.format(
								"The set-returning from node '%s' does not specify an index/ordinality",
								sqmPath.getNavigablePath()
						)
				);
			}
		}
		else {
			checkPluralPath( sqmPath, referencedPathSource, firstNode );
		}

		if ( getCreationOptions().useStrictJpaCompliance() ) {
			final var attribute = (PluralPersistentAttribute<?, ?, ?>) referencedPathSource;
			if ( attribute.getCollectionClassification() != CollectionClassification.MAP
					&& firstNode.getSymbol().getType() == HqlParser.KEY ) {
				throw new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.KEY_FUNCTION_ON_NON_MAP );
			}
		}

View on GitHub (pinned to fad1729dce)

Solutions

  1. The set-returning from node requires an index/ordinality reference. Add WITH ORDINALITY / an index specification to the set-returning function in the from clause.

When it happens

Trigger: A set-returning function in the from clause lacks ordinality: The set-returning from node '<value>' does not specify an index/ordinality

Common situations: Using unnest()/other set-returning functions in the from clause without WITH ORDINALITY where required.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/fb67f76bba4c5890. Report an issue: GitHub.