hibernate/hibernate-orm · error · FunctionArgumentException

Function %s() has %d parameters, but %d arguments given

Error message

Function %s() has %d parameters, but %d arguments given

What it means

Error "Function %s() has %d parameters, but %d arguments given" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/StandardArgumentsValidators.java:117

					sig.append("arg").append(i);
				}
				sig.append("[, arg");
				sig.append(minNumOfArgs);
				sig.append("[, ...]])");
				return sig.toString();
			}
		};
	}

	public static ArgumentsValidator exactly(int number) {
		return new ArgumentsValidator() {
			@Override
			public void validate(
					List<? extends SqmTypedNode<?>> arguments,
					String functionName,
					BindingContext bindingContext) {
				if ( arguments.size() != number ) {
					throw new FunctionArgumentException(
							String.format(
									Locale.ROOT,
									"Function %s() has %d parameters, but %d arguments given",
									functionName,
									number,
									arguments.size()
							)
					);
				}
			}

			@Override
			public String getSignature() {
				final var sig = new StringBuilder("(");
				for (int i=0; i<number; i++) {
					if (i!=0) {
						sig.append(", ");
					}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Wrong number of arguments for the function.
  2. Supply exactly the declared number of arguments.

When it happens

Trigger: A function call in a query supplies arguments that violate the function's signature.

Common situations: Passing the wrong number or types of arguments (e.g. untyped nulls, tuples) to HQL/SQL functions.


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