hibernate/hibernate-orm · error · TerminalPathException

List index has no attributes

Error message

List index has no attributes

What it means

Error "List index has no attributes" thrown in hibernate/hibernate-orm.

Source

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

		}

		SqmPath<?> result;
		if ( sqmPath instanceof SqmMapJoin<?, ?, ?> sqmMapJoin ) {
			if ( consumer instanceof QualifiedJoinPathConsumer pathConsumer ) {
				if ( madeNested && !hasContinuation ) {
					// Reset the nested state before consuming the terminal identifier
					pathConsumer.setNested( false );
				}
				consumer.consumeIdentifier( CollectionPart.Nature.INDEX.getName(), false, !hasContinuation );
				result = (SqmPath<?>) consumer.getConsumedPart();
			}
			else {
				result = sqmMapJoin.key();
			}
		}
		else if ( sqmPath instanceof SqmListJoin<?, ?> listJoin ) {
			if ( hasContinuation ) {
				throw new TerminalPathException("List index has no attributes");
			}
			result = listJoin.resolvePathPart( CollectionPart.Nature.INDEX.getName(), true, this );
		}
		else if ( sqmPath instanceof SqmFunctionRoot<?> functionRoot ) {
			if ( hasContinuation ) {
				throw new TerminalPathException("List index has no attributes");
			}
			result = functionRoot.index();
		}
		else if ( sqmPath instanceof SqmFunctionJoin<?> functionJoin ) {
			if ( hasContinuation ) {
				throw new TerminalPathException("List index has no attributes");
			}
			result = functionJoin.index();
		}
		else {
			assert sqmPath instanceof SqmPluralValuedSimplePath;
			final SqmPluralValuedSimplePath<?> mapPath = (SqmPluralValuedSimplePath<?>) sqmPath;

View on GitHub (pinned to fad1729dce)

Solutions

  1. A list index has no attributes to navigate. Do not dereference attributes of the index expression; use the index value directly.

When it happens

Trigger: An attribute path is dereferenced from a list index: List index has no attributes

Common situations: Navigating 'list[index].something' where the index has no attributes.


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