hibernate/hibernate-orm · error · FunctionArgumentException

Function () requires at least arguments, but only arguments…

Error message

Function %s() requires at least %d arguments, but only %d arguments given

What it means

FunctionArgumentException from the min() arity validator: fewer arguments were supplied than the function's declared minimum arity.

Solutions

  1. Too few arguments were given for the function.
  2. Supply at least the required number of arguments for the function call.
Defensive patterns

Strategy: validation

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/71aedbf3145bf6e9. Report an issue: GitHub.

Appendix: source

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

		@Override
		public String getSignature() {
			return "()";
		}
	};

	public static ArgumentsValidator min(int minNumOfArgs) {
		if (minNumOfArgs<1) {
			throw new IllegalArgumentException();
		}
		return new ArgumentsValidator() {
			@Override
			public void validate(
					List<? extends SqmTypedNode<?>> arguments,
					String functionName,
					BindingContext bindingContext) {
				if ( arguments.size() < minNumOfArgs ) {
					throw new FunctionArgumentException(
							String.format(
									Locale.ROOT,
									"Function %s() requires at least %d arguments, but only %d arguments given",
									functionName,
									minNumOfArgs,
									arguments.size()
							)
					);
				}
			}

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

View on GitHub (pinned to fad1729dce)