{"record":{"id":"b6c81e6b5748f40f","repo":"quarkusio/quarkus","slug":"no-disposed-parameters-found-for-disposermethod","errorCode":null,"errorMessage":"No disposed parameters found for ${disposerMethod}","messagePattern":"No disposed parameters found for (.+?)","errorType":"exception","errorClass":"DefinitionException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DisposerInfo.java","lineNumber":101,"sourceCode":"        if (resultingQualifiers.isEmpty()) {\n            resultingQualifiers.add(AnnotationInstance.builder(Default.class).build());\n        }\n        return resultingQualifiers;\n    }\n\n    Type getDisposedParameterType() {\n        return disposerMethod.parameterType(disposedParameter.position());\n    }\n\n    MethodParameterInfo initDisposedParam(MethodInfo disposerMethod) {\n        List<MethodParameterInfo> disposedParams = new ArrayList<>();\n        for (AnnotationInstance annotation : disposerMethod.annotations()) {\n            if (Kind.METHOD_PARAMETER == annotation.target().kind() && annotation.name().equals(DotNames.DISPOSES)) {\n                disposedParams.add(annotation.target().asMethodParameter());\n            }\n        }\n        if (disposedParams.isEmpty()) {\n            throw new DefinitionException(\"No disposed parameters found for \" + disposerMethod);\n        } else if (disposedParams.size() > 1) {\n            throw new DefinitionException(\"Multiple disposed parameters found for \" + disposerMethod);\n        }\n        return disposedParams.get(0);\n    }\n}\n","sourceCodeStart":83,"sourceCodeEnd":108,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DisposerInfo.java#L83-L108","documentation":"A disposer method must have exactly one @Disposes-annotated parameter identifying what it disposes. DisposerInfo.initDisposedParam throws this DefinitionException when the disposer method has no @Disposes parameter at all.","triggerScenarios":"A method registered as a disposer (Arc found it during bean discovery as the disposer of a producer) has zero parameters annotated @Disposes — e.g. the annotation was forgotten, removed, or applied to the wrong method.","commonSituations":"Typing the disposer signature by hand and omitting @Disposes; moving the annotation to the wrong parameter; upgrading Arc/Quarkus where stricter validation catches an old signature; IDE auto-complete dropping the annotation.","solutions":["Annotate exactly one parameter of the disposer method with @Disposes.","Ensure that parameter's type matches the type produced by the corresponding @Produces method.","If the method was not meant to be a disposer, remove any mismatched method parameters or move the method out of the producing bean.","Verify only one parameter carries @Disposes (more than one triggers the sibling 'Multiple disposed parameters' error)."],"exampleFix":"// before\nvoid close(Resource r) { r.shutdown(); } // missing @Disposes\n\n// after\nvoid close(@Disposes Resource r) { r.shutdown(); }","handlingStrategy":"validation","validationCode":"long disposed = Arrays.stream(disposerMethod.getParameters())\n    .filter(p -> p.isAnnotationPresent(jakarta.enterprise.inject.Disposes.class)).count();\nif (disposed == 0) throw new IllegalStateException(\"Disposer must have one @Disposes parameter: \" + disposerMethod);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always annotate exactly one disposer parameter with @Disposes.","Match the disposed parameter type to the producer's return type.","Let the IDE generate disposer methods instead of typing signatures by hand."],"tags":["cdi","disposer","producer","quarkus-arc"],"backgroundTag":"disposer-missing-disposes-parameter","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"}