{"record":{"id":"2b710c318a46898d","repo":"apache/druid","slug":"s-malformed-url-for-druidnode-s-and-baseurl","errorCode":null,"errorMessage":"%s: Malformed url for DruidNode [%s] and baseUrl [%s]","messagePattern":"(.+?): Malformed url for DruidNode \\[(.+?)\\] and baseUrl \\[(.+?)\\]","errorType":"exception","errorClass":"RE","httpStatus":null,"severity":"error","filePath":"extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/sync/RestUpdateSender.java","lineNumber":190,"sourceCode":"                      cacheNotificationsTimeoutMs,\n                      TimeUnit.MILLISECONDS\n                  );\n  }\n\n  private URL getListenerURL(DruidNode druidNode, String baseUrl)\n  {\n    try {\n      return new URL(\n          druidNode.getServiceScheme(),\n          druidNode.getHost(),\n          druidNode.getPortToUse(),\n          baseUrl\n      );\n    }\n    catch (MalformedURLException mue) {\n      String msg = StringUtils.format(callerName + \": Malformed url for DruidNode [%s] and baseUrl [%s]\", druidNode, baseUrl);\n      LOG.error(msg);\n      throw new RE(mue, msg);\n    }\n  }\n}\n","sourceCodeStart":172,"sourceCodeEnd":194,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/sync/RestUpdateSender.java#L172-L194","documentation":"getListenerURL builds the catalog sync listener URL from a DruidNode's host/port and a baseUrl. If java.net.URL considers the constructed string malformed (bad host characters, missing scheme after concat, illegal port), it logs and rethrows as a ResourceException (RE) wrapping the MalformedURLException.","triggerScenarios":"accept() → getListenerURL() with a druidNode whose host contains invalid URL characters (e.g. underscores, IPv6 literal without brackets) or a baseUrl missing the http(s):// scheme, so the concatenation 'scheme://host:port/baseUrl' fails URL parsing.","commonSituations":"Kubernetes pod names with underscores used as druid.host; baseUrl configured without protocol; misconfigured druid.host containing scheme already (double scheme); special characters from templated config values.","solutions":["Fix druid.host to a valid URL hostname (RFC 1123: no underscores, use hyphens) and restart.","Ensure baseUrl includes the scheme, e.g. 'http://' or 'https://'.","If using IPv6, set druid.host to the bracketed form or a resolvable hostname.","Log/inspect the generated URL string (druidNode + baseUrl) to spot the malformed part, then correct the config value."],"exampleFix":"// before\ndruid.host=my_pod_name   // underscore -> Malformed URL\n\n// after\ndruid.host=my-pod-name.my-namespace.svc.cluster.local","handlingStrategy":"validation","validationCode":"String host = druidNode.getHost();\nif (host.contains(\"_\") || !baseUrl.matches(\"^https?://.*\")) {\n  throw new IllegalArgumentException(\"Invalid druid.host or baseUrl missing scheme: \" + host + \", \" + baseUrl);\n}","typeGuard":null,"tryCatchPattern":"try {\n  URL url = getListenerURL(druidNode, callerName, baseUrl);\n} catch (RE e) {\n  LOG.error(\"Bad catalog listener URL config: host=%s baseUrl=%s\", druidNode.getHost(), baseUrl);\n}","preventionTips":["Use RFC 1123 hostnames (hyphens, no underscores) for druid.host.","Always include http:// or https:// in baseUrl config.","Validate templated host values in CI before deploy.","Bracket IPv6 addresses or prefer resolvable hostnames."],"tags":["url","configuration","network"],"backgroundTag":"invalid-url-format","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}