{"record":{"id":"234350e95c90123c","repo":"quarkusio/quarkus","slug":"no-parameter-of-type-classinfo-methodinfo-fieldi","errorCode":null,"errorMessage":"No parameter of type ClassInfo, MethodInfo, FieldInfo, ClassConfig, MethodConfig, or FieldConfig for method \" + method","messagePattern":"No parameter of type ClassInfo, MethodInfo, FieldInfo, ClassConfig, MethodConfig, or FieldConfig for method \" \\+ method","errorType":"exception","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/bcextensions/ExtensionPhaseEnhancement.java","lineNumber":41,"sourceCode":"    }\n\n    @Override\n    void runExtensionMethod(ExtensionMethod method) throws ReflectiveOperationException {\n        int numQueryParameters = 0;\n        List<ExtensionMethodParameter> parameters = new ArrayList<>(method.parametersCount());\n        for (org.jboss.jandex.Type parameterType : method.parameterTypes()) {\n            ExtensionMethodParameter parameter = ExtensionMethodParameter.of(parameterType);\n            parameters.add(parameter);\n\n            if (parameter.isQuery()) {\n                numQueryParameters++;\n            }\n\n            parameter.verifyAvailable(ExtensionPhase.ENHANCEMENT, method);\n        }\n\n        if (numQueryParameters == 0) {\n            throw new DefinitionException(\"No parameter of type ClassInfo, MethodInfo, FieldInfo, \"\n                    + \"ClassConfig, MethodConfig, or FieldConfig for method \" + method);\n        }\n\n        if (numQueryParameters > 1) {\n            throw new DefinitionException(\"More than 1 parameter of type ClassInfo, MethodInfo, FieldInfo, \"\n                    + \"ClassConfig, MethodConfig, or FieldConfig for method \" + method);\n        }\n\n        ExtensionMethodParameter query = parameters.stream()\n                .filter(ExtensionMethodParameter::isQuery)\n                .findAny()\n                .get(); // guaranteed to be there\n\n        List<org.jboss.jandex.ClassInfo> matchingClasses = matchingClasses(method.jandex);\n        List<?> allValuesForQueryParameter;\n        if (query == ExtensionMethodParameter.CLASS_INFO) {\n            allValuesForQueryParameter = matchingClasses.stream()\n                    .map(it -> new ClassInfoImpl(index, annotationOverlay, it))","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/bcextensions/ExtensionPhaseEnhancement.java#L23-L59","documentation":"Arc requires every build-time @Enhancement extension method to have exactly one 'query' parameter — a ClassInfo, MethodInfo, FieldInfo, ClassConfig, MethodConfig, or FieldConfig — that identifies what is being enhanced. ExtensionPhaseEnhancement.runExtensionMethod() throws DefinitionException during processing when it counts zero such parameters, because it cannot know which classes/members the method applies to.","triggerScenarios":"Annotating a no-arg method (or one whose only parameters are config/context types, not the six query types) with @Enhancement in a build-time extension, so numQueryParameters == 0 when the processor runs the method.","commonSituations":"Writing an enhancement callback that only takes the enhancement context and forgetting the target info/config parameter; refactoring a method and accidentally removing its ClassInfo/MethodConfig parameter; applying @Enhancement to a plain helper method by mistake.","solutions":["Add exactly one query parameter of type ClassInfo, MethodInfo, FieldInfo, ClassConfig, MethodConfig, or FieldConfig to the @Enhancement method.","If the method was not meant to enhance anything, remove the @Enhancement annotation or the method entirely.","Verify the parameter types come from the correct packages (org.jboss.jandex for *Info, the config API for *Config) so they are recognized as query parameters."],"exampleFix":"// before\n@Enhancement\nvoid enhance(EnhancementContext ctx) { ... }\n\n// after\n@Enhancement\nvoid enhance(ClassConfig config, EnhancementContext ctx) { ... }","handlingStrategy":"validation","validationCode":"long queries = Arrays.stream(method.getParameters())\n    .map(p -> p.type().name().withoutPackagePrefix())\n    .filter(n -> Set.of(\"ClassInfo\",\"MethodInfo\",\"FieldInfo\",\"ClassConfig\",\"MethodConfig\",\"FieldConfig\").contains(n))\n    .count();\nif (queries == 0) throw new IllegalStateException(\"@Enhancement method needs a query parameter\");","typeGuard":"static boolean hasQueryParameter(MethodInfo m) {\n    return Arrays.stream(m.parameters()).anyMatch(ExtensionPhaseEnhancement::isQueryType);\n}","tryCatchPattern":"try {\n    processor.run(extensionClass);\n} catch (DefinitionException e) {\n    fail(\"@Enhancement method missing target parameter: \" + e.getMessage());\n}","preventionTips":["Always give every @Enhancement method exactly one Info/Config query parameter as its first parameter.","Never apply @Enhancement to helper methods.","Review extension method signatures in code review against phase rules."],"tags":["arc","cdi","build-time-extension","quarkus"],"backgroundTag":"missing-extension-query-parameter","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"}