{"record":{"id":"446cf40e02fe856f","repo":"apache/pulsar","slug":"the-value-struri-in-the-advertisedlisteners-c","errorCode":null,"errorMessage":"the value ${strUri} in the `advertisedListeners` configure is invalid","messagePattern":"the value (.+?) in the `advertisedListeners` configure is invalid","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java","lineNumber":234,"sourceCode":"                        }\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    /**\n     * Synthesize an {@link AdvertisedListener} for the internal listener from the legacy port\n     * configuration (`brokerServicePort`, `brokerServicePortTls`, `webServicePort`,\n     * `webServicePortTls`). Returns {@code null} if no binary port and no web port is set; the caller\n     * is then responsible for raising an error if the internal listener is still missing after","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/validator/MultipleListenerValidator.java#L216-L252","documentation":"Any failure while parsing a single URI inside `advertisedListeners` — including malformed URI syntax and the redundant/duplicate-listener IllegalArgumentExceptions thrown in the same try block — is caught and rethrown as this IllegalArgumentException wrapping the original value and cause. It indicates one specific comma-separated entry in the configuration is invalid.","triggerScenarios":"`advertisedListeners` contains a malformed URI (e.g. `pulsar://host:notaport`), a duplicate-scheme entry, or a host:port shared with another listener; any of these gets wrapped with the offending strUri in the message.","commonSituations":"Typos in scheme (e.g. `pulsar:/host:6650`), missing port, spaces or stray characters in the value, duplicate URIs from copy-paste, YAML/properties quoting issues mangling the value.","solutions":["Read the `cause` of the exception: it names the exact failing entry and the real reason (duplicate scheme, shared host:port, or URI syntax)","Validate the URI parses (URI.create) and has a supported scheme (pulsar, pulsar+ssl, http, https) before deploying the config","Remove or fix the offending entry in `advertisedListeners`"],"exampleFix":"// before\nadvertisedListeners=external:pulsar://h1:notaport\n// after\nadvertisedListeners=external:pulsar://h1:6650","handlingStrategy":"try-catch","validationCode":"for (String entry : advertisedListeners.split(\",\")) {\n    String value = entry.substring(entry.indexOf(':') + 1).trim();\n    URI uri = URI.create(value);\n    String scheme = uri.getScheme();\n    if (scheme == null || !Set.of(\"pulsar\",\"pulsar+ssl\",\"http\",\"https\").contains(scheme.toLowerCase()))\n        throw new IllegalStateException(\"unsupported URI: \" + value);\n    if (uri.getHost() == null || uri.getPort() == -1)\n        throw new IllegalStateException(\"URI missing host/port: \" + value);\n}","typeGuard":null,"tryCatchPattern":"try {\n    startBroker(config);\n} catch (IllegalArgumentException e) {\n    // message is \"the value <strUri> in the `advertisedListeners` configure is invalid\"\n    log.error(\"Bad advertisedListeners entry: {} (cause: {})\", e.getMessage(), e.getCause());\n    throw e;\n}","preventionTips":["Inspect e.getCause() to find the real failing entry and reason","Pre-validate each URI (scheme, host, port) before deployment","Quote values properly in YAML/properties to avoid mangling","Keep one change per config edit to isolate breakage"],"tags":["configuration","broker-startup","validation","uri","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"}