spring-projects/spring-framework · error · IllegalStateException

Unsupported executable {}

Error message

Unsupported executable {}

What it means

BeanInstanceSupplier.instantiate handles only Constructor and Method executables; reaching the final throw means the executable was neither. Like error 209 this is a defensive guard for an exotic non-standard Executable type and should not occur with stock JDK reflection.

Source

Thrown at spring-beans/src/main/java/org/springframework/beans/factory/aot/BeanInstanceSupplier.java:371

		}
		if (executable instanceof Method method) {
			Object target = null;
			String factoryBeanName = registeredBean.getMergedBeanDefinition().getFactoryBeanName();
			if (factoryBeanName != null) {
				target = registeredBean.getBeanFactory().getBean(factoryBeanName, method.getDeclaringClass());
			}
			else if (!Modifier.isStatic(method.getModifiers())) {
				throw new IllegalStateException("Cannot invoke instance method without factoryBeanName: " + method);
			}
			try {
				ReflectionUtils.makeAccessible(method);
				return method.invoke(target, args);
			}
			catch (Throwable ex) {
				throw new BeanInstantiationException(method, ex.getMessage(), ex);
			}
		}
		throw new IllegalStateException("Unsupported executable " + executable.getClass().getName());
	}


	private static String toCommaSeparatedNames(Class<?>... parameterTypes) {
		return Arrays.stream(parameterTypes).map(Class::getName).collect(Collectors.joining(", "));
	}


	/**
	 * Performs lookup of the {@link Executable}.
	 */
	abstract static class ExecutableLookup {

		abstract Executable get(RegisteredBean registeredBean);
	}


	/**

View on GitHub (pinned to e8729d0438)

Solutions

  1. Locate the instrumentation/agent producing the non-standard executable and disable or update it for the affected build.
  2. Reproduce with the agent removed to confirm it is the source.
  3. Report upstream if it reproduces on a clean JDK.
Defensive patterns

Strategy: type-guard

Validate before calling

Executable e = ...;
if (!(e instanceof Constructor || e instanceof Method)) {
  throw new IllegalStateException("Unsupported executable: " + e.getClass());
}

Type guard

boolean isStandardExecutable(Executable e) {
  return e instanceof Constructor || e instanceof Method;
}

Prevention

When it happens

Trigger: The instantiation path receives an Executable that is neither Constructor nor Method - typically introduced by bytecode manipulation or a custom reflection implementation.

Common situations: Bytecode-rewriting/agent tools that synthesize Executable subclasses; using a forked JDK with extended reflection types. Rarely seen in normal applications.

Related errors


AI-assisted analysis of spring-projects/spring-framework@e8729d0438 (2026-08-04). Data as JSON: /data/errors/aa958ca8ece42a7d.json. Report an issue: GitHub.