{"record":{"id":"ab3fad068aeba693","repo":"quarkusio/quarkus","slug":"filter-filtername-was-defined-multiple-times","errorCode":null,"errorMessage":"Filter '${filterName}' was defined multiple times.","messagePattern":"Filter '(.+?)' was defined multiple times\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java","lineNumber":388,"sourceCode":"                    if (FILTER.equals(iface)) {\n                        hasFilterInterface = true;\n                        break;\n                    }\n                }\n                if (hasFilterInterface) {\n                    isFilterImpl = true;\n                    break;\n                }\n                currentClassInfo = index.getClassByName(currentClassInfo.superName());\n            }\n            if (!isFilterImpl) {\n                throw new RuntimeException(\n                        ILLEGAL_LOGGING_FILTER_USE_MESSAGE + \" Offending class is '\" + classInfo.name() + \"'\");\n            }\n\n            String filterName = instance.value(\"name\").asString();\n            if (filtersMap.containsKey(filterName)) {\n                throw new RuntimeException(\"Filter '\" + filterName + \"' was defined multiple times.\");\n            }\n            filtersMap.put(filterName, classInfo.name().toString());\n        }\n        if (!filtersMap.isEmpty()) {\n            result.setNameToFilterClass(filtersMap);\n        }\n\n        return result;\n    }\n\n    @BuildStep(onlyIfNot = IsProduction.class)\n    @Produce(TestSetupBuildItem.class)\n    @Produce(LogConsoleFormatBuildItem.class)\n    @Consume(ConsoleInstalledBuildItem.class)\n    void setupStackTraceFormatter(\n            ApplicationArchivesBuildItem item,\n            List<ExceptionNotificationBuildItem> exceptionNotificationBuildItems,\n            CuratedApplicationShutdownBuildItem curatedApplicationShutdownBuildItem,","sourceCodeStart":370,"sourceCodeEnd":406,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java#L370-L406","documentation":"discoverLogComponents throws this RuntimeException when two @LoggingFilter annotated classes declare the same 'name' attribute value. Filter names must be unique because they are referenced from log category configuration (console filter refs), so duplicates are rejected at build time.","triggerScenarios":"Two different classes both annotated with @LoggingFilter(name = \"same-name\"); the build step's filtersMap detects the second put on an existing key and fails.","commonSituations":"Copy-pasting a filter class and forgetting to change the name; two libraries/extensions shipping filters with a colliding default name.","solutions":["Rename the 'name' value on one of the duplicate @LoggingFilter annotations so each is unique.","Search the project (and dependencies' sources) for @LoggingFilter to find all classes using the conflicting name.","If the collision comes from a dependency, use a distinct, project-qualified name in your own filter."],"exampleFix":"// before\nclass A { }  @LoggingFilter(name = \"my-filter\") class B { }\n// after\n@LoggingFilter(name = \"my-filter-a\") class A { }\n@LoggingFilter(name = \"my-filter-b\") class B { }","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (Class<?> c : List.of(FilterA.class, FilterB.class)) {\n    String name = c.getAnnotation(LoggingFilter.class).name();\n    if (!seen.add(name)) throw new IllegalStateException(\"Duplicate filter name: \" + name);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give each @LoggingFilter a unique, project-qualified name.","Grep the codebase for @LoggingFilter(name = before adding a new filter.","When copy-pasting a filter class, rename both the class and the annotation name."],"tags":["quarkus","build-time","logging","duplicate-name"],"backgroundTag":"duplicate-registration","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}