{"record":{"id":"adf3ad34686fb607","repo":"apache/pulsar","slug":"there-are-redundant-configure-for-listener-list","errorCode":null,"errorMessage":"there are redundant configure for listener `${listenerName}`","messagePattern":"there are redundant configure for listener `(.+?)`","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java","lineNumber":189,"sourceCode":"            if (StringUtils.isEmpty(str)) {\n                continue;\n            }\n            int index = str.indexOf(\":\");\n            if (index <= 0) {\n                throw new IllegalArgumentException(\"the configure entry `advertisedListeners` is invalid. because \"\n                        + str + \" do not contain listener name\");\n            }\n            String listenerName = StringUtils.trim(str.substring(0, index));\n            validateListenerName(listenerName);\n            String value = StringUtils.trim(str.substring(index + 1));\n            listeners.computeIfAbsent(listenerName, k -> new ArrayList<>(2));\n            listeners.get(listenerName).add(value);\n        }\n        final Map<String, AdvertisedListener> result = new LinkedHashMap<>();\n        final Map<String, Set<String>> reverseMappings = new LinkedHashMap<>();\n        for (final Map.Entry<String, List<String>> entry : listeners.entrySet()) {\n            if (entry.getValue().size() > 4) {\n                throw new IllegalArgumentException(\"there are redundant configure for listener `\" + entry.getKey()\n                        + \"`\");\n            }\n            URI pulsarAddress = null, pulsarSslAddress = null, pulsarHttpAddress = null, pulsarHttpsAddress = null;\n            for (final String strUri : entry.getValue()) {\n                try {\n                    URI uri = URI.create(strUri);\n                    if (\"pulsar\".equalsIgnoreCase(uri.getScheme())) {\n                        if (pulsarAddress == null) {\n                            pulsarAddress = uri;\n                        } else {\n                            throw new IllegalArgumentException(\"there are redundant configure for listener `\"\n                                    + entry.getKey() + \"`\");\n                        }\n                    } else if (\"pulsar+ssl\".equalsIgnoreCase(uri.getScheme())) {\n                        if (pulsarSslAddress == null) {\n                            pulsarSslAddress = uri;\n                        } else {\n                            throw new IllegalArgumentException(\"there are redundant configure for listener `\"","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java#L171-L207","documentation":"During broker startup, Pulsar parses the `advertisedListeners` configuration into named listeners. Each listener name may map to at most four URIs, one per supported scheme (pulsar, pulsar+ssl, http, https). If more than four comma-separated entries share the same listener name, the validator rejects the config with this IllegalArgumentException before the broker can start.","triggerScenarios":"Setting `advertisedListeners` in broker.conf / ServiceConfiguration with more than 4 `name:scheme://host:port` entries using the same listener name, e.g. five or more URIs separated by commas for one listener.","commonSituations":"Copy-paste accumulation of duplicated or obsolete listener URIs across config edits; generating the config from a script that appends an entry per protocol without de-duplicating; misunderstanding that a listener accepts at most one URI per scheme (max 4 total).","solutions":["Edit broker.conf / advertisedListeners so each listener name has at most 4 URIs — one per scheme: pulsar://, pulsar+ssl://, http://, https://","Remove duplicate or obsolete URIs for the listener named in the message","Split genuinely different endpoints into separate listener names (e.g. `internal:...`, `external:...`) instead of piling URIs under one name","Restart the broker and confirm startup passes validation"],"exampleFix":"# before\nadvertisedListeners=external:pulsar://h1:6650,pulsar+ssl://h1:6651,http://h1:8080,https://h1:8443,pulsar://h2:6650\n# after\nadvertisedListeners=external:pulsar://h1:6650,pulsar+ssl://h1:6651,http://h1:8080,https://h1:8443","handlingStrategy":"validation","validationCode":"Map<String,Integer> counts = new HashMap<>();\nfor (String entry : advertisedListeners.split(\",\")) {\n    String name = entry.substring(0, entry.indexOf(':')).trim();\n    counts.merge(name, 1, Integer::sum);\n}\nif (counts.values().stream().anyMatch(c -> c > 4))\n    throw new IllegalArgumentException(\"a listener may have at most 4 URIs (one per scheme)\");","typeGuard":null,"tryCatchPattern":"try {\n    startBroker(config);\n} catch (IllegalArgumentException e) {\n    log.error(\"Invalid advertisedListeners: {}\", e.getMessage());\n    throw new ConfigurationException(e.getMessage(), e);\n}","preventionTips":["Keep at most one URI per scheme (pulsar, pulsar+ssl, http, https) per listener name","Lint broker.conf in CI before deploy","Split different endpoints into distinct listener names"],"tags":["configuration","broker-startup","validation","pulsar"],"backgroundTag":"invalid-broker-configuration","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}