quarkusio/quarkus · error · IllegalArgumentException
Parameter type '<type>' is not supported for method '<method
Error message
Parameter type '<type>' is not supported for method '<method>' of class '<class>'
What it means
In the bytecode-generation phase (invokeExceptionHandlerMethod), a parameter that is not an Exception subtype, HttpServletRequest, or HttpServletResponse cannot be bound to a generated value, so IllegalArgumentException is thrown naming the type, method, and class. This is the runtime-body counterpart of the pre-generation signature validation and aborts the build.
Source
Thrown at extensions/spring-web/core/deployment/src/main/java/io/quarkus/spring/web/deployment/ControllerAdviceExceptionMapperGenerator.java:285
if (typesUtil.isAssignable(Exception.class, parameterType.name())) {
parameterTypeHandles[i] = bc.localVar("param" + i, exceptionParam);
} else if (typesUtil.isAssignable(UriInfo.class, parameterType.name())) {
parameterTypeHandles[i] = bc.localVar("param" + i, getBeanFromArc(bc, UriInfo.class.getName()));
} else if (typesUtil.isAssignable(Request.class, parameterType.name())) {
parameterTypeHandles[i] = bc.localVar("param" + i, getBeanFromArc(bc, Request.class.getName()));
} else if (typesUtil.isAssignable(HttpServerRequest.class, parameterType.name())) {
parameterTypeHandles[i] = bc.localVar("param" + i,
getBeanFromArc(bc, HttpServerRequest.class.getName()));
} else if (typesUtil.isAssignable(HttpServerResponse.class, parameterType.name())) {
LocalVar requestHandle = bc.localVar("request",
getBeanFromArc(bc, HttpServerRequest.class.getName()));
parameterTypeHandles[i] = bc.localVar("param" + i, bc.invokeInterface(
MethodDesc.of(HttpServerRequest.class,
"response",
HttpServerResponse.class),
requestHandle));
} else {
throw new IllegalArgumentException(
"Parameter type '" + parameterType.name() + "' is not supported for method '"
+ controllerAdviceMethod.name() + "' of class '"
+ controllerAdviceMethod.declaringClass().name()
+ "'");
}
}
}
return bc.invokeVirtual(
ClassMethodDesc.of(declaringClassDesc, controllerAdviceMethod.name(), returnTypeClassDesc,
parameterTypeClassDescs),
controllerAdviceInstance(bc), parameterTypeHandles);
}
private LocalVar controllerAdviceInstance(BlockCreator bc) {
ClassDesc declaringClassDesc = ClassDesc.of(declaringClassName);
if (isResteasyClassic) {
LocalVar controllerAdviceClass = bc.localVar("controllerAdviceClass",View on GitHub (pinned to e1c734241f)
Solutions
- Restrict handler parameters to Exception subtypes, HttpServletRequest, and HttpServletResponse
- Remove or refactor unsupported parameters from the @ControllerAdvice method
- Rebuild after the fix; this is a build-time failure so no runtime workaround exists
- If the type is essential, write a standard JAX-RS ExceptionMapper instead of relying on Spring @ControllerAdvice mapping
Example fix
// before
@ExceptionHandler(Exception.class)
void handle(Exception e, Locale locale) {...}
// after
@ExceptionHandler(Exception.class)
void handle(Exception e, HttpServletRequest req) { Locale locale = req.getLocale(); ... } Defensive patterns
Strategy: validation
Validate before calling
if (!Exception.class.isAssignableFrom(paramType) && !HttpServletRequest.class.isAssignableFrom(paramType)
&& !HttpServletResponse.class.isAssignableFrom(paramType)) {
throw new IllegalStateException("Handler param " + paramType + " unsupported by ControllerAdvice mapper");
} Type guard
boolean isSupportedHandlerParam(Class<?> t) {
return Exception.class.isAssignableFrom(t)
|| HttpServletRequest.class.isAssignableFrom(t)
|| HttpServletResponse.class.isAssignableFrom(t);
} Prevention
- Validate handler signatures against supported types before building
- Prefer JAX-RS ExceptionMapper for parameters beyond the supported set
- Rebuild early in migration to surface generation errors immediately
When it happens
Trigger: A @ControllerAdvice @ExceptionHandler method whose parameters include a type outside the supported set slipping past pre-generation checks (e.g. unusual orderings or types the pre-check path did not flag) and failing while emitting invoke bytecode.
Common situations: Migrating complex Spring exception handlers; parameter types like Model, Locale, HttpHeaders, or custom context objects; framework version changes altering which signatures are validated earlier.
Related errors
- Parameter type <type> is not supported for method<method> of
- Parameter type <type> is being used multiple times in method
- @ExceptionHandler methods in @ControllerAdvice must be publi
- You can only have a single class annotated with @ControllerA
- Name cannot start with '/':${name}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/9c6d615f31c8442a.
Report an issue: GitHub.