{"record":{"id":"5b922aed0d4a6aef","repo":"quarkusio/quarkus","slug":"multiple-disposed-parameters-found-for-disposerm","errorCode":null,"errorMessage":"Multiple disposed parameters found for ${disposerMethod}","messagePattern":"Multiple 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":103,"sourceCode":"        }\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":85,"sourceCodeEnd":108,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DisposerInfo.java#L85-L108","documentation":"ArC (Quarkus's CDI implementation) requires that a disposer method has exactly one disposed parameter — the parameter annotated @Disposes. This DefinitionException is thrown at build time when a disposer method declares two or more @Disposes-annotated parameters, which is illegal per the CDI specification.","triggerScenarios":"Declaring a disposer method with more than one parameter annotated @Disposes, e.g. void dispose(@Disposes A a, @Disposes B b).","commonSituations":"Copy-paste of a disposer for a second bean type inside one method; refactoring where an old disposed parameter was left behind; misunderstanding that the @Disposes annotation marks the single disposed parameter.","solutions":["Keep exactly one @Disposes-annotated parameter per disposer method; remove the extra @Disposes annotation or split into separate disposer methods","If you intended to dispose two different beans, write one disposer method per producer/bean","Verify the @Disposes import is jakarta.enterprise.inject.Disposes and it was not accidentally duplicated by an IDE quick-fix"],"exampleFix":"// before\nvoid dispose(@Disposes DbConnection c, @Disposes DbConnection c2) { ... }\n// after\nvoid dispose(@Disposes DbConnection c) { ... }","handlingStrategy":"validation","validationCode":"long disposedCount = java.util.Arrays.stream(disposerMethod.getParameters())\n    .filter(p -> p.isAnnotationPresent(jakarta.enterprise.inject.Disposes.class)).count();\nif (disposedCount != 1) throw new IllegalStateException(\"Disposer must have exactly one @Disposes parameter: \" + disposerMethod);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Exactly one @Disposes parameter per disposer method","Additional parameters must be @Binding-qualified for lookup, never @Disposes","Run a Quarkus build early — ArC catches this at build time"],"tags":["cdi","arc","disposer","build-time"],"backgroundTag":"cdi-definition-error","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"}