{"record":{"id":"b0acb980542067d5","repo":"quarkusio/quarkus","slug":"parameter-parametername-of-method-targetme-b0acb9","errorCode":null,"errorMessage":"Parameter '${parameterName}' of method '${targetMethod.name()} of class '${targetClass.name()}' is not allowed","messagePattern":"Parameter '(.+?)' of method '(.+?) of class '(.+?)' is not allowed","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/exceptionmappers/ServerExceptionMapperGenerator.java","lineNumber":610,"sourceCode":"                BranchResult ifNullBranch = mc.ifNull(runtimeResourceHandle);\n                ifNullBranch.trueBranch().assign(resourceInfo, ifNullBranch.trueBranch().readStaticField(FieldDescriptor\n                        .of(SimpleResourceInfo.NullValues.class, \"INSTANCE\", SimpleResourceInfo.NullValues.class)));\n                ifNullBranch.falseBranch().assign(resourceInfo, ifNullBranch.falseBranch().invokeVirtualMethod(\n                        ofMethod(RuntimeResource.class, \"getLazyMethod\", ResteasyReactiveResourceInfo.class),\n                        runtimeResourceHandle));\n                targetMethodParamHandles[i] = resourceInfo;\n            } else if (SIMPLIFIED_RESOURCE_INFO.equals(paramDotName)) {\n                ResultHandle runtimeResourceHandle = runtimeResourceHandle(mc, contextHandle);\n                AssignableResultHandle resourceInfo = mc.createVariable(SimpleResourceInfo.class);\n                BranchResult ifNullBranch = mc.ifNull(runtimeResourceHandle);\n                ifNullBranch.trueBranch().assign(resourceInfo, ifNullBranch.trueBranch().readStaticField(FieldDescriptor\n                        .of(SimpleResourceInfo.NullValues.class, \"INSTANCE\", SimpleResourceInfo.NullValues.class)));\n                ifNullBranch.falseBranch().assign(resourceInfo, ifNullBranch.falseBranch().invokeVirtualMethod(\n                        ofMethod(RuntimeResource.class, \"getSimplifiedResourceInfo\", SimpleResourceInfo.class),\n                        runtimeResourceHandle));\n                targetMethodParamHandles[i] = resourceInfo;\n            } else {\n                throw new RuntimeException(\"Parameter '\" + parameterName + \"' of method '\" + targetMethod.name()\n                        + \" of class '\" + targetClass.name()\n                        + \"' is not allowed\");\n            }\n        }\n        return new TargetMethodParamsInfo(targetMethodParamHandles, parameterTypes);\n    }\n\n    private static ReturnType determineReturnType(MethodInfo targetMethod) {\n        if (targetMethod.returnType().name().equals(RESPONSE)) {\n            return ReturnType.RESPONSE;\n        } else if (targetMethod.returnType().name().equals(REST_RESPONSE)) {\n            return ReturnType.REST_RESPONSE;\n        } else if (targetMethod.returnType().kind() == Type.Kind.PARAMETERIZED_TYPE) {\n            ParameterizedType parameterizedType = targetMethod.returnType().asParameterizedType();\n            if (parameterizedType.name().equals(UNI) && (parameterizedType.arguments().size() == 1)) {\n                if (parameterizedType.arguments().get(0).name().equals(RESPONSE)) {\n                    return ReturnType.UNI_RESPONSE;\n                }","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/exceptionmappers/ServerExceptionMapperGenerator.java#L592-L628","documentation":"getTargetMethodParamsInfo maps each @ServerExceptionMapper method parameter to a bytecode handle for a supported injectable type (Throwable, the handled exception, UriInfo, HttpHeaders, Request, ResourceInfo, CurrentRequest, etc.). A parameter whose type is not in the supported set cannot be injected, so a RuntimeException naming the offending parameter is thrown at build time.","triggerScenarios":"A @ServerExceptionMapper method declares a parameter that is not the handled exception/Throwable and not one of the supported context types (UriInfo, HttpHeaders, Request, ResourceInfo, SecurityContext, Providers, Application, Configuration, SimpleResourceInfo...), e.g. a custom service or CDI bean.","commonSituations":"Injecting a CDI bean or custom context object directly into the mapper method; passing the request body or a DTO; assuming mapper methods can take arbitrary @Context-like parameters.","solutions":["Remove the unsupported parameter and inject the needed object into the mapper class instead (field @Inject or constructor injection)","Convert the parameter to one of the supported types (e.g. UriInfo, HttpHeaders, Request, ResourceInfo)","Fetch required data via the supported context objects inside the method body"],"exampleFix":"// before\n@ServerExceptionMapper\npublic Response map(NotFoundException e, MyService service) {...}\n// after\npublic class MyMapper {\n  @Inject MyService service;\n  @ServerExceptionMapper\n  public Response map(NotFoundException e) {...}\n}","handlingStrategy":"validation","validationCode":"// Verify mapper parameters are all injectable types\nSet<Class<?>> allowed = Set.of(Throwable.class, UriInfo.class, HttpHeaders.class,\n    Request.class, ResourceInfo.class, SecurityContext.class, Providers.class,\n    jakarta.ws.rs.core.Application.class, Configuration.class);\nfor (Method m : mapperMethods) {\n  for (Class<?> p : m.getParameterTypes())\n    if (!allowed.contains(p)) throw new IllegalStateException(\"Unsupported mapper param \" + p + \" in \" + m);\n}","typeGuard":"boolean isInjectableMapperParam(Class<?> p) {\n  return Throwable.class.isAssignableFrom(p)\n    || p == UriInfo.class || p == HttpHeaders.class || p == Request.class\n    || p == ResourceInfo.class || p == SecurityContext.class || p == Configuration.class;\n}","tryCatchPattern":null,"preventionTips":["Only use exception + supported @Context-style types as mapper parameters","Inject CDI beans via class fields/constructor injection, not method parameters","Consult the RESTEasy Reactive docs list of supported mapper parameters","Keep mapper signatures minimal and fetch auxiliary data inside the method body"],"tags":["quarkus","resteasy-reactive","serverexceptionmapper","build-time"],"backgroundTag":"exception-mapper-parameter-validation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}