hibernate/hibernate-orm · error · FunctionArgumentException

Parameter of function ' ()' has type ' ', but argument is…

Error message

Parameter %d of function '%s()' has type '%s', but argument is of type '%s' mapped to '%s'

What it means

FunctionArgumentException from throwError: the argument's Java type (mapped to the given SQL type) does not satisfy the function parameter's declared FunctionParameterType.

Solutions

  1. The argument's mapped type does not match the function parameter's declared type.
  2. Cast the argument to the required type or pass a value of the correct mapped type.
Defensive patterns

Strategy: type-guard

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/70bc589874c4a9ee. Report an issue: GitHub.

Appendix: source

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

			default -> true; // TODO: should we throw here?
		};
	}

	private static void throwError(
			FunctionParameterType type, Type javaType, String sqlType, String functionName, int paramNumber) {
		if ( sqlType == null ) {
			throw new FunctionArgumentException(
					String.format(
							"Parameter %d of function '%s()' has type '%s', but argument is of type '%s'",
							paramNumber,
							functionName,
							type,
							javaType.getTypeName()
					)
			);
		}
		else {
			throw new FunctionArgumentException(
					String.format(
							"Parameter %d of function '%s()' has type '%s', but argument is of type '%s' mapped to '%s'",
							paramNumber,
							functionName,
							type,
							javaType.getTypeName(),
							sqlType
					)
			);
		}
	}

	private static void throwTupleError(
			FunctionParameterType type, String functionName, int paramNumber) {
		throw new FunctionArgumentException(
				String.format(
						"Parameter %d of function '%s()' has type '%s', but argument is a tuple",
						paramNumber,

View on GitHub (pinned to fad1729dce)