{"record":{"id":"cb92d8fa4c989610","repo":"eclipse-vertx/vert.x","slug":"cannot-read-hosts-config","errorCode":null,"errorMessage":"Cannot read hosts config ","messagePattern":"Cannot read hosts config ","errorType":"exception","errorClass":"io.vertx.core.VertxException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/dns/impl/DnsAddressResolverProvider.java","lineNumber":247,"sourceCode":"  }\n\n  private void refreshHostsFile() {\n    HostsFileEntries entries;\n    if (hostsPath != null) {\n      File file = vertx.fileResolver().resolve(hostsPath).getAbsoluteFile();\n      try {\n        if (!file.exists() || !file.isFile()) {\n          throw new IOException();\n        }\n        entries = HostsFileParser.parse(file);\n      } catch (IOException e) {\n        throw new VertxException(\"Cannot read hosts file \" + file.getAbsolutePath());\n      }\n    } else if (hostsValue != null) {\n      try {\n        entries = HostsFileParser.parse(new StringReader(hostsValue.toString()));\n      } catch (IOException e) {\n        throw new VertxException(\"Cannot read hosts config \", e);\n      }\n    } else {\n      entries = HostsFileParser.parseSilently();\n    }\n    parsedHostsFile = entries;\n  }\n\n  private static class ResolverRegistration {\n    private final io.netty.resolver.AddressResolver<InetSocketAddress> resolver;\n    private final EventLoop executor;\n    ResolverRegistration(io.netty.resolver.AddressResolver<InetSocketAddress> resolver, EventLoop executor) {\n      this.resolver = resolver;\n      this.executor = executor;\n    }\n  }\n\n  // Avoid FastThreadLocal query server address stream default implementation\n  private static class ThreadLocalNameServerAddressStream implements DnsServerAddressStream {","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/dns/impl/DnsAddressResolverProvider.java#L229-L265","documentation":"Runtime error while parsing the hosts config supplied as an in-memory string (hostsValue): HostsFileParser threw an IOException while reading the StringReader. The message is a generic sentinel for a malformed hosts-format value; the offending input is the hostsValue string itself.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/dns/impl/DnsAddressResolverProvider.java:247 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the hosts-value string to follow the hosts file format (IP hostname aliases per line)","Remove malformed lines and let the next refresh re-parse the corrected value"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}