hibernate/hibernate-orm · error · IllegalArgumentException

No function registered under the name '{}'

Error message

No function registered under the name '{}'

What it means

DynamicDispatchFunction is the descriptor Hibernate registers for overloaded function names; at construction it sanity-checks that every overload name is already present in the SqmFunctionRegistry. If one of the names passed to its constructor is not registered, it throws this IllegalArgumentException immediately, catching registration-order bugs.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/DynamicDispatchFunction.java:45

 */
public class DynamicDispatchFunction implements SqmFunctionDescriptor, ArgumentsValidator {
	private final SqmFunctionRegistry functionRegistry;
	private final String[] functionNames;
	private final FunctionKind functionKind;

	public DynamicDispatchFunction(SqmFunctionRegistry functionRegistry, String... functionNames) {
		this.functionRegistry = functionRegistry;
		this.functionNames = functionNames;
		this.functionKind = functionKind( functionRegistry, functionNames );
	}

	private static FunctionKind functionKind(SqmFunctionRegistry functionRegistry, String[] functionNames) {
		FunctionKind functionKind = null;
		// Sanity check
		for ( String overload : functionNames ) {
			final var functionDescriptor = functionRegistry.findFunctionDescriptor( overload );
			if ( functionDescriptor == null ) {
				throw new IllegalArgumentException( "No function registered under the name '" + overload + "'" );
			}
			if ( functionKind == null ) {
				functionKind = functionDescriptor.getFunctionKind();
			}
			else if ( functionKind != functionDescriptor.getFunctionKind() ) {
				throw new IllegalArgumentException( "Function has function kind " + functionDescriptor.getFunctionKind()
													+ ", but other overloads have " + functionKind
													+ ". An overloaded function needs a single function kind." );
			}
		}
		return functionKind;
	}

	@Override
	public FunctionKind getFunctionKind() {
		return functionKind;
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Register every underlying overload descriptor before constructing the DynamicDispatchFunction for it
  2. Check the exact names (case, underscores) passed as functionNames against the keys you registered
  3. If an overload was intentionally removed, also remove its name from the DynamicDispatchFunction constructor call

Example fix

// before
registry.registerFunction("myfunc", new DynamicDispatchFunction(registry, "myfunc_int", "myfunc_str"));
registry.registerUnaryBinaryFunction... // myfunc_str registered too late

// after
registry.registerBinaryFunction("myfunc_int", intDescriptor);
registry.registerBinaryFunction("myfunc_str", strDescriptor);
registry.registerFunction("myfunc", new DynamicDispatchFunction(registry, "myfunc_int", "myfunc_str"));
Defensive patterns

Strategy: validation

Validate before calling

for (String name : functionNames) {
    if (registry.findFunctionDescriptor(name) == null) {
        throw new IllegalStateException("Register '" + name + "' before creating DynamicDispatchFunction");
    }
}
new DynamicDispatchFunction(registry, functionNames);

Prevention

When it happens

Trigger: Programmatic registration like functionRegistry.registerFunction(...)/registerOverload(...) wiring a DynamicDispatchFunction('f','f_a','f_b') before 'f_b' exists in the registry; usually only hit by dialect authors or apps customizing SqmFunctionRegistry at bootstrap.

Common situations: Custom dialect development registering overloads in the wrong order; copying registration snippets between dialects and dropping one registerUnaryBinaryFunction/... call; bootstrap-time unit tests that build a partial registry.

Related errors


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