quarkusio/quarkus · error · RuntimeException

Filter '${filterName}' was defined multiple times.

Error message

Filter '${filterName}' was defined multiple times.

What it means

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.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java:388

                    if (FILTER.equals(iface)) {
                        hasFilterInterface = true;
                        break;
                    }
                }
                if (hasFilterInterface) {
                    isFilterImpl = true;
                    break;
                }
                currentClassInfo = index.getClassByName(currentClassInfo.superName());
            }
            if (!isFilterImpl) {
                throw new RuntimeException(
                        ILLEGAL_LOGGING_FILTER_USE_MESSAGE + " Offending class is '" + classInfo.name() + "'");
            }

            String filterName = instance.value("name").asString();
            if (filtersMap.containsKey(filterName)) {
                throw new RuntimeException("Filter '" + filterName + "' was defined multiple times.");
            }
            filtersMap.put(filterName, classInfo.name().toString());
        }
        if (!filtersMap.isEmpty()) {
            result.setNameToFilterClass(filtersMap);
        }

        return result;
    }

    @BuildStep(onlyIfNot = IsProduction.class)
    @Produce(TestSetupBuildItem.class)
    @Produce(LogConsoleFormatBuildItem.class)
    @Consume(ConsoleInstalledBuildItem.class)
    void setupStackTraceFormatter(
            ApplicationArchivesBuildItem item,
            List<ExceptionNotificationBuildItem> exceptionNotificationBuildItems,
            CuratedApplicationShutdownBuildItem curatedApplicationShutdownBuildItem,

View on GitHub (pinned to e1c734241f)

Solutions

  1. Rename the 'name' value on one of the duplicate @LoggingFilter annotations so each is unique.
  2. Search the project (and dependencies' sources) for @LoggingFilter to find all classes using the conflicting name.
  3. If the collision comes from a dependency, use a distinct, project-qualified name in your own filter.

Example fix

// before
class A { }  @LoggingFilter(name = "my-filter") class B { }
// after
@LoggingFilter(name = "my-filter-a") class A { }
@LoggingFilter(name = "my-filter-b") class B { }
Defensive patterns

Strategy: validation

Validate before calling

Set<String> seen = new HashSet<>();
for (Class<?> c : List.of(FilterA.class, FilterB.class)) {
    String name = c.getAnnotation(LoggingFilter.class).name();
    if (!seen.add(name)) throw new IllegalStateException("Duplicate filter name: " + name);
}

Prevention

When it happens

Trigger: 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.

Common situations: Copy-pasting a filter class and forgetting to change the name; two libraries/extensions shipping filters with a colliding default name.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/ab3fad068aeba693. Report an issue: GitHub.