{"record":{"id":"b0f65ac0064ba6b3","repo":"apache/pulsar","slug":"must-not-specify-hostport-to-different-listen","errorCode":null,"errorMessage":"must not specify `${hostPort}` to different listener.","messagePattern":"must not specify `(.+?)` to different listener\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java","lineNumber":230,"sourceCode":"                            pulsarHttpAddress = uri;\n                        } else {\n                            throw new IllegalArgumentException(\"there are redundant configure for listener `\"\n                                    + entry.getKey() + \"`\");\n                        }\n                    } else if (\"https\".equalsIgnoreCase(uri.getScheme())) {\n                        if (pulsarHttpsAddress == null) {\n                            pulsarHttpsAddress = uri;\n                        } else {\n                            throw new IllegalArgumentException(\"there are redundant configure for listener `\"\n                                    + entry.getKey() + \"`\");\n                        }\n                    }\n\n                    String hostPort = formatHostPort(uri);\n                    Set<String> sets = reverseMappings.computeIfAbsent(hostPort, k -> new TreeSet<>());\n                    sets.add(entry.getKey());\n                    if (sets.size() > 1) {\n                        throw new IllegalArgumentException(\"must not specify `\" + hostPort\n                                + \"` to different listener.\");\n                    }\n                } catch (Throwable cause) {\n                    throw new IllegalArgumentException(\"the value \" + strUri + \" in the `advertisedListeners` \"\n                            + \"configure is invalid\", cause);\n                }\n            }\n            result.put(entry.getKey(), AdvertisedListener.builder()\n                    .brokerServiceUrl(pulsarAddress)\n                    .brokerServiceUrlTls(pulsarSslAddress)\n                    .brokerHttpUrl(pulsarHttpAddress)\n                    .brokerHttpsUrl(pulsarHttpsAddress)\n                    .build());\n        }\n        return result;\n    }\n\n    /**","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java#L212-L248","documentation":"The validator builds a reverse mapping from each URI's host:port to the listener names using it. If the same host:port is assigned to more than one listener name, client routing by address becomes ambiguous, so parseAdvertisedListeners throws this IllegalArgumentException (it is then wrapped by the catch block as \"the value ... is invalid\").","triggerScenarios":"Two different listener names in `advertisedListeners` whose URIs resolve to the identical host:port, e.g. `a:pulsar://h:6650` and `b:pulsar://h:6650` (host:port comparison after formatHostPort, case-insensitive scheme handling).","commonSituations":"Cloning a listener block and only renaming the listener, not the port; advertising the same port for internal and external listeners; one entry pointing at a shared LB address used by another listener.","solutions":["Give each listener a unique host:port — change the port of one of the conflicting URIs","If both listeners must expose the same address, collapse them into a single listener name","Check behind any proxies/LB: the advertised host:port itself must differ per listener"],"exampleFix":"// before\nadvertisedListeners=internal:pulsar://h1:6650,external:pulsar://h1:6650\n// after\nadvertisedListeners=internal:pulsar://h1:6650,external:pulsar://h1:16650","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (String entry : advertisedListeners.split(\",\")) {\n    URI uri = URI.create(entry.substring(entry.indexOf(':') + 1).trim());\n    String hostPort = uri.getHost() + \":\" + uri.getPort();\n    if (!seen.add(hostPort))\n        throw new IllegalStateException(\"host:port \" + hostPort + \" used by multiple listeners\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    startBroker(config);\n} catch (IllegalArgumentException e) {\n    log.error(\"Listener port conflict: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Assign a unique host:port to every listener","Never clone a listener block without changing the port","Keep a documented port allocation table for the cluster"],"tags":["configuration","broker-startup","validation","port-conflict","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"}