hibernate/hibernate-orm · error · FunctionArgumentException

Parameter %d of function '%s()' does not permit untyped expr

Error message

Parameter %d of function '%s()' does not permit untyped expressions like null literals. Please cast the expression to a type

What it means

Error "Parameter %d of function '%s()' does not permit untyped expressions like null literals. Please cast the expression to a type" thrown in hibernate/hibernate-orm.

Source

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

						}
						break;
					// the following are not really necessary for the functions we have today
					// since collations and trim specifications have special parser rules,
					// but at the very least this is an assertion that we don't get given
					// something crazy by the parser
					case TRIM_SPEC:
						if ( !(argument instanceof SqmTrimSpecification) ) {
							throwError(parameterType, Object.class, null, functionName, count);
						}
						break;
					case COLLATION:
						if ( !(argument instanceof SqmCollation) ) {
							throwError(parameterType, Object.class, null, functionName, count);
						}
						break;
					case NO_UNTYPED:
						if ( argument instanceof SqmLiteralNull<?> ) {
							throw new FunctionArgumentException(
									String.format(
											"Parameter %d of function '%s()' does not permit untyped expressions like null literals. Please cast the expression to a type",
											count,
											functionName
									)
							);
						}
						break;
				}
			}
			else {
				//TODO: appropriate error?
			}
		}
	}

	private void checkArgumentType(
			String functionName,

View on GitHub (pinned to fad1729dce)

Solutions

  1. An untyped expression (e.g. a null literal) was passed where the function parameter requires a typed value.
  2. Cast the expression, e.g. cast(null as String), or pass a typed parameter.

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