eclipse-vertx/vert.x · error · io.vertx.core.VertxException
Cannot read hosts config
Error message
Cannot read hosts config
What it means
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.
Source
Thrown at vertx-core/src/main/java/io/vertx/core/dns/impl/DnsAddressResolverProvider.java:247
}
private void refreshHostsFile() {
HostsFileEntries entries;
if (hostsPath != null) {
File file = vertx.fileResolver().resolve(hostsPath).getAbsoluteFile();
try {
if (!file.exists() || !file.isFile()) {
throw new IOException();
}
entries = HostsFileParser.parse(file);
} catch (IOException e) {
throw new VertxException("Cannot read hosts file " + file.getAbsolutePath());
}
} else if (hostsValue != null) {
try {
entries = HostsFileParser.parse(new StringReader(hostsValue.toString()));
} catch (IOException e) {
throw new VertxException("Cannot read hosts config ", e);
}
} else {
entries = HostsFileParser.parseSilently();
}
parsedHostsFile = entries;
}
private static class ResolverRegistration {
private final io.netty.resolver.AddressResolver<InetSocketAddress> resolver;
private final EventLoop executor;
ResolverRegistration(io.netty.resolver.AddressResolver<InetSocketAddress> resolver, EventLoop executor) {
this.resolver = resolver;
this.executor = executor;
}
}
// Avoid FastThreadLocal query server address stream default implementation
private static class ThreadLocalNameServerAddressStream implements DnsServerAddressStream {View on GitHub (pinned to fb308bd8c3)
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
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/dns/impl/DnsAddressResolverProvider.java:247 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06).
Data as JSON: /api/errors/cb92d8fa4c989610.
Report an issue: GitHub.