{"record":{"id":"8f5f37e7c3bcd8a7","repo":"quarkusio/quarkus","slug":"unknown-type-type-used-as-an-annotation-in-co","errorCode":null,"errorMessage":"Unknown type '${type}' used as an annotation in constructor of class '${resourceDotName}'","messagePattern":"Unknown type '(.+?)' used as an annotation in constructor of class '(.+?)'","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java","lineNumber":315,"sourceCode":"                            resultHandle = m.getMethodParam(otherParamIndex);\n                            otherParamIndex++;\n                        } else if (type == CtorParamData.CustomProducerParameterType.HEADER) {\n                            resultHandle = m.invokeVirtualMethod(getHeaderParamMethodCreator.getMethodDescriptor(), m.getThis(),\n                                    m.load(ctorParamDatum.getAnnotationValue()));\n                        } else if (type == CtorParamData.CustomProducerParameterType.QUERY) {\n                            resultHandle = m.invokeVirtualMethod(getQueryParamMethodCreator.getMethodDescriptor(), m.getThis(),\n                                    m.load(ctorParamDatum.getAnnotationValue()));\n                        } else if (type == CtorParamData.CustomProducerParameterType.PATH) {\n                            resultHandle = m.invokeVirtualMethod(getPathParamMethodCreator.getMethodDescriptor(), m.getThis(),\n                                    m.load(0)); // TODO: this is not correct, we really need to look up the index\n                        } else if (type == CtorParamData.CustomProducerParameterType.MATRIX) {\n                            resultHandle = m.invokeVirtualMethod(getMatrixParamMethodCreator.getMethodDescriptor(), m.getThis(),\n                                    m.load(ctorParamDatum.getAnnotationValue()));\n                        } else if (type == CtorParamData.CustomProducerParameterType.COOKIE) {\n                            resultHandle = m.invokeVirtualMethod(getCookieParamMethodCreator.getMethodDescriptor(), m.getThis(),\n                                    m.load(ctorParamDatum.getAnnotationValue()));\n                        } else {\n                            throw new IllegalStateException(\"Unknown type '\" + type\n                                    + \"' used as an annotation in constructor of class '\" + resourceDotName + \"'\");\n                        }\n                        ctorParamHandles.add(resultHandle);\n                    }\n\n                    // FIXME: this doesn't actually support injection in the resource instance\n                    m.returnValue(m.newInstance(ctor, ctorParamHandles.toArray(new ResultHandle[0])));\n                }\n            }\n            // FIXME: support constructors for bean params too\n            additionalBeanBuildItemBuildProducer\n                    .produce(AdditionalBeanBuildItem.builder()\n                            .addBeanClasses(parameterContainersThatNeedCustomProducer.stream().map(DotName::toString).toList())\n                            // FIXME: we should add this, but for that we also need to make the resource class request-scoped\n                            //                                                         .setDefaultScope(DOTNAME_REQUEST_SCOPED)\n                            //                                                         .setUnremovable()\n                            .build());\n        }","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java#L297-L333","documentation":"During bytecode generation of the custom producer's constructor, each parameter kind (QUERY, PATH, MATRIX, COOKIE) is mapped to the corresponding request-reading virtual method. If a CtorParamData carries a CustomProducerParameterType outside that set, generation fails with this IllegalStateException. It is a defensive branch that normal user code cannot reach: it only fires if the annotation-to-type mapping and the bytecode switch drift apart.","triggerScenarios":"Only reachable if a new CustomProducerParameterType is introduced in the annotation-mapping phase (e.g. support for a new JAX-RS parameter annotation) without extending the bytecode-generation switch, or via internal misuse of CtorParamData. Not reachable from user REST code under normal circumstances.","commonSituations":"Custom/patched Quarkus builds, adding framework-level support for a new parameter annotation, or other code constructing CtorParamData with a hand-rolled type.","solutions":["Verify the exact Quarkus version and file an upstream Quarkus issue with the resource class signature and full stack trace","If patching the extension, add the missing branch in the type switch of the generated-constructor bytecode section","As a workaround, switch the resource to field/method parameter injection instead of constructor injection"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Report the failure upstream to Quarkus with stack trace and resource class signature — this branch indicates a framework bug","Do not hand-construct CtorParamData with custom parameter types","Pin a released Quarkus version; avoid locally patched extensions without matching codegen"],"tags":["resteasy-reactive","quarkus","internal","codegen","defensive"],"backgroundTag":"unreachable-codegen-branch","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}