{"record":{"id":"3caacfdefa63e0c3","repo":"apache/druid","slug":"failed-to-construct-server-url","errorCode":null,"errorMessage":"Failed to construct server URL.","messagePattern":"Failed to construct server URL\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java","lineNumber":562,"sourceCode":"    {\n      this.druidServer = druidServer;\n\n      try {\n        HostAndPort hostAndPort = HostAndPort.fromString(druidServer.getHost());\n        this.syncer = new ChangeRequestHttpSyncer<>(\n            smileMapper,\n            httpClient,\n            inventorySyncExecutor,\n            new URL(druidServer.getScheme(), hostAndPort.getHost(), hostAndPort.getPort(), \"/\"),\n            \"/druid-internal/v1/segments\",\n            SEGMENT_LIST_RESP_TYPE_REF,\n            config.getServerTimeout(),\n            config.getServerUnstabilityTimeout(),\n            createSyncListener()\n        );\n      }\n      catch (MalformedURLException ex) {\n        throw new IAE(ex, \"Failed to construct server URL.\");\n      }\n    }\n\n    void start()\n    {\n      syncer.start();\n    }\n\n    void stop()\n    {\n      syncer.stop();\n      stopped.set(true);\n    }\n\n    boolean isStopped()\n    {\n      return stopped.get();\n    }","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/client/HttpServerInventoryView.java#L544-L580","documentation":"When creating a DruidServerHolder, the server's host string is converted into a URL for the queryable-server syncer. A MalformedURLException from that conversion is wrapped in IAE with this message, meaning the configured host string is not a valid URL/authority format.","triggerScenarios":"druid.client.httpServerInventory entries or discovery payloads containing hosts with invalid characters, missing scheme/hostname, or malformed host:port values.","commonSituations":"Typo'd host config (e.g. 'http:/host:8080' single slash), whitespace or control characters in host, port values with invalid characters, discovery service returning malformed host strings.","solutions":["Fix the offending host string to be scheme://hostname:port (valid URL authority)","Validate host configuration at startup before it reaches the inventory view","Check the external discovery source for malformed entries","Log/inspect the wrapped MalformedURLException cause for the exact parse failure"],"exampleFix":"// before\nconfig.getHost() == \"http:/broker1:8080\" // MalformedURLException\n// after\nconfig.getHost() == \"http://broker1:8080\"","handlingStrategy":"validation","validationCode":"private static void validateHost(String host) {\n  try { new java.net.URL(host); } catch (MalformedURLException e) { throw new IllegalArgumentException(\"bad host: \" + host, e); }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate host strings as URLs at config load time","Use scheme://hostname:port format consistently","Check discovery service output format"],"tags":["url","configuration","malformed-host"],"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-14T11:17:12.474Z"}