hibernate/hibernate-orm · error · FunctionArgumentException

Argument '%s' of '%s()' function is not a plural path

Error message

Argument '%s' of '%s()' function is not a plural path 

What it means

Error "Argument '%s' of '%s()' function is not a plural path " thrown in hibernate/hibernate-orm.

Source

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

			final var collectionFunctionMisuse = functionExpression.function().collectionFunctionMisuse();
			if ( collectionFunctionMisuse != null ) {
				return visitCollectionFunctionSelection( collectionFunctionMisuse );
			}
		}
		return null;
	}

	private SqmPluralPartSelectionPath<?> visitCollectionFunctionSelection(
			HqlParser.CollectionFunctionMisuseContext ctx) {
		if ( getCreationOptions().useStrictJpaCompliance() ) {
			throw new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.HQL_COLLECTION_FUNCTION );
		}

		final var pluralAttributePath = consumeDomainPath( ctx.path() );
		final var firstNode = (TerminalNode) ctx.getChild( 0 ).getChild( 0 );

		if ( !( pluralAttributePath.getReferencedPathSource() instanceof PluralPersistentAttribute<?, ?, ?> ) ) {
			throw new FunctionArgumentException(
					String.format(
							"Argument '%s' of '%s()' function is not a plural path ",
							pluralAttributePath.getNavigablePath(),
							firstNode.getSymbol().getText()
					)
			);
		}

		return new SqmPluralPartSelectionPath<>(
				(SqmPluralValuedSimplePath<?>) pluralAttributePath,
				collectionFunctionNature( firstNode )
		);
	}

	@Override
	public SqmDynamicInstantiation<?> visitInstantiation(HqlParser.InstantiationContext ctx) {
		final var dynamicInstantiation = visitInstantiationTarget( ctx.instantiationTarget() );
		for ( var arg : ctx.instantiationArguments().instantiationArgument() ) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass a plural (collection-valued) path to the collection function.
  2. Check that the argument is a mapped collection attribute.

When it happens

Trigger: A runtime precondition of the Hibernate API is violated.

Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.


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