{"record":{"id":"2307d4eed0fe970b","repo":"quarkusio/quarkus","slug":"only-one-handler-can-be-configured-with-the-same-n","errorCode":null,"errorMessage":"Only one handler can be configured with the same name '%s'","messagePattern":"Only one handler can be configured with the same name '(.+?)'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java","lineNumber":532,"sourceCode":"        if (additionalNamedHandlers.isEmpty()) {\n            additionalNamedHandlersMap = emptyMap();\n        } else {\n            additionalNamedHandlersMap = new HashMap<>();\n            for (RuntimeValue<Map<String, Handler>> runtimeValue : additionalNamedHandlers) {\n                runtimeValue.getValue().forEach(\n                        new AdditionalNamedHandlersConsumer(additionalNamedHandlersMap, errorManager,\n                                cleanupFilter.filterElements.values(), shutdownHandler));\n            }\n        }\n\n        namedHandlers.putAll(additionalNamedHandlersMap);\n\n        return namedHandlers;\n    }\n\n    private static void addToNamedHandlers(Map<String, Handler> namedHandlers, Handler handler, String handlerName) {\n        if (namedHandlers.containsKey(handlerName)) {\n            throw new RuntimeException(String.format(\"Only one handler can be configured with the same name '%s'\",\n                    handlerName));\n        }\n        namedHandlers.put(handlerName, handler);\n        InitialConfigurator.DELAYED_HANDLER.addLoggingCloseTask(new Runnable() {\n            @Override\n            public void run() {\n                handler.close();\n            }\n        });\n    }\n\n    private static void addNamedHandlersToCategory(\n            CategoryConfig categoryConfig, Map<String, Handler> namedHandlers,\n            Logger categoryLogger,\n            ErrorManager errorManager,\n            boolean checkHandlerLinks) {\n        for (String categoryNamedHandler : categoryConfig.handlers().get()) {\n            Handler handler = namedHandlers.get(categoryNamedHandler);","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java#L514-L550","documentation":"When building named log handlers from configuration, addToNamedHandlers refuses to add two handlers with the same handler name, throwing a RuntimeException with 'Only one handler can be configured with the same name'. Handler names must be unique because they are map keys used to route category handlers.","triggerScenarios":"Two handler configuration blocks in application.properties resolve to the same handler name, or a category references/creates the same named handler twice (e.g. quarkus.log.handler.console.\"x\".name duplicated across console/file/syslog handlers).","commonSituations":"Copy-pasted handler config blocks with identical name properties; generating handler configs programmatically where names collide; merging configuration profiles that both define the same named handler.","solutions":["Give each configured handler a unique name in application.properties","Remove the duplicate handler configuration block","If handlers are created programmatically, ensure createNamedHandlers/addToNamedHandlers is called once per handler with a distinct name"],"exampleFix":"// before\nquarkus.log.handler.console.\"a\".name=LOG\nquarkus.log.handler.file.\"f\".name=LOG\n// after\nquarkus.log.handler.console.\"a\".name=CONSOLE_LOG\nquarkus.log.handler.file.\"f\".name=FILE_LOG","handlingStrategy":"validation","validationCode":"// pre-validate handler names in config are unique\nSet<String> seen = new HashSet<>();\nfor (String name : configuredHandlerNames()) { if (!seen.add(name)) throw new IllegalArgumentException(\"Duplicate handler name: \" + name); }","typeGuard":null,"tryCatchPattern":"try { configureLogging(); } catch (RuntimeException e) { if (e.getMessage().contains(\"Only one handler can be configured with the same name\")) log.error(\"Handler names must be unique: \" + e.getMessage()); else throw e; }","preventionTips":["Use descriptive, unique names for every handler block in application.properties","Review merged config profiles for name collisions","Code-review logging configuration changes"],"tags":["logging","configuration","duplicate-key"],"backgroundTag":"duplicate-handler-name","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"}