quarkusio/quarkus · error · RuntimeException

Parameter '${parameterName}' of method '${targetMethod.name(

Error message

Parameter '${parameterName}' of method '${targetMethod.name()} of class '${declaringClassName}' is not allowed

What it means

getRequestFilterResultHandles maps each parameter of a @ServerRequestFilter method to generated bytecode handles. Only supported parameter types are allowed: the ContainerRequestContext itself, unwrappable types (e.g. UriInfo, HttpHeaders, SecurityContext, request bodies via registered providers), and Continuation for Kotlin suspend methods. Any other parameter type throws this RuntimeException and fails the build.

Source

Thrown at independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/filters/CustomFilterGenerator.java:362

                        "getHttpHeaders",
                        HttpHeadersImpl.class);
            } else if (REQUEST.equals(paramDotName)) {
                GeneratorUtils.paramHandleFromReqContextMethod(filterMethod, rrReqCtxHandle, targetMethodParamHandles,
                        i,
                        "getRequest",
                        REQUEST);
            } else if (RESOURCE_INFO.equals(paramDotName)) {
                targetMethodParamHandles[i] = getResourceInfoHandle(filterMethod, rrReqCtxHandle);
            } else if (ResteasyReactiveServerDotNames.SIMPLIFIED_RESOURCE_INFO.equals(paramDotName)) {
                targetMethodParamHandles[i] = getSimpleResourceInfoHandle(filterMethod, rrReqCtxHandle);
            } else if (ResteasyReactiveDotNames.CONTINUATION.equals(paramDotName)) {
                // the continuation to pass on to the target is retrieved from the last parameter of the filter method
                targetMethodParamHandles[i] = filterMethod.getMethodParam(filterMethodParamCount - 1);
            } else if (unwrappableTypes.contains(paramDotName)) {
                targetMethodParamHandles[i] = GeneratorUtils.unwrapObject(filterMethod, rrReqCtxHandle, paramDotName);
            } else {
                String parameterName = targetMethod.parameterName(i);
                throw new RuntimeException("Parameter '" + parameterName + "' of method '" + targetMethod.name()
                        + " of class '" + declaringClassName
                        + "' is not allowed");
            }
        }
        return targetMethodParamHandles;
    }

    String generateContainerResponseFilter(MethodInfo targetMethod, ClassOutput classOutput) {
        checkModifiers(targetMethod, ResteasyReactiveServerDotNames.SERVER_RESPONSE_FILTER);
        if (KotlinUtils.isSuspendMethod(targetMethod)) {
            return generateResponseFilterForSuspendedMethod(targetMethod, classOutput, isOptionalFilter.test(targetMethod));
        }
        return generateStandardContainerResponseFilter(targetMethod, classOutput, isOptionalFilter.test(targetMethod));
    }

    private String generateResponseFilterForSuspendedMethod(MethodInfo targetMethod, ClassOutput classOutput,
            boolean checkForOptionalBean) {
        DotName returnDotName = determineReturnDotNameOfSuspendMethod(targetMethod);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove or replace the unsupported parameter with a supported one (ContainerRequestContext, UriInfo, HttpHeaders, SecurityContext, etc.)
  2. If you need a bean, inject it into the declaring class (field/constructor) instead of the filter method
  3. Retrieve needed data from the ContainerRequestContext inside the filter body
  4. Ensure body-type parameters are supported by the configured message body readers

Example fix

// before
@ServerRequestFilter
public void filter(ContainerRequestContext ctx, MyService svc) { ... }

// after
@ServerRequestFilter
public void filter(ContainerRequestContext ctx) {
    MyService svc = Arc.container().instance(MyService.class).get();
}
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<Class<?>> ALLOWED = Set.of(ContainerRequestContext.class, UriInfo.class,
    HttpHeaders.class, SecurityContext.class, HttpHost.class);
for (Class<?> p : filterMethod.getParameterTypes()) {
    if (!ALLOWED.contains(p) && !isUnwrappable(p) && p != Continuation.class) {
        throw new IllegalStateException("Unsupported request filter parameter: " + p);
    }
}

Type guard

static boolean isSupportedRequestFilterParam(Class<?> p) {
    return ContainerRequestContext.class.isAssignableFrom(p)
        || UriInfo.class.equals(p) || HttpHeaders.class.equals(p) || SecurityContext.class.equals(p)
        || Continuation.class.equals(p);
}

Prevention

When it happens

Trigger: Declaring a @ServerRequestFilter method with a parameter whose type is not an injectable/filter-supported type — e.g. a custom POJO, ServletRequest, or an unregistered body type.

Common situations: Adding convenience parameters to filters expecting CDI-style injection, porting filters from other frameworks, or forgetting @Context/@Param-style qualifiers where required.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/4b3ee8460b0b4a09. Report an issue: GitHub.