AdguardTeam/AdGuardHome · error
parsing etc/resolv.conf file: %w
Error message
parsing etc/resolv.conf file: %w
What it means
searchFiles (via setQLogReader) opens a reader over the current and rotated query-log files. If newQLogReader cannot open or parse any of them, the error is wrapped as 'opening qlog reader' and the search fails. This occurs while servicing a query-log search request.
Source
Thrown at internal/aghnet/net_darwin.go:212
const filename = "etc/resolv.conf"
_, err = aghos.FileWalker(func(r io.Reader) (_ []string, _ bool, err error) {
sc := bufio.NewScanner(r)
for sc.Scan() {
matches := etcResolvConfReg.FindAllStringSubmatch(sc.Text(), -1)
if len(matches) == 0 {
continue
}
for _, m := range matches {
addrs = append(addrs, m[1])
}
}
return nil, false, sc.Err()
}).Walk(rootDirFS, filename)
if err != nil {
return nil, fmt.Errorf("parsing etc/resolv.conf file: %w", err)
} else if len(addrs) == 0 {
return nil, fmt.Errorf("found no dns servers in %s", filename)
}
return addrs, nil
}
View on GitHub (pinned to b41aefbe51)
Solutions
- Check the wrapped error for the offending file and OS/parse cause
- Repair or delete corrupted rotated log files so the reader can proceed
- Align versions (don't downgrade below the log format version) or archive old logs elsewhere
- Fix read permissions on the log files and directory
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check readability of log files
for _, f := range files {
if fi, err := os.Stat(f); err == nil && fi.Mode().IsRegular() {
if fh, err := os.Open(f); err != nil { return err } else { fh.Close() }
}
} Try / catch
results, err := qlog.Search(ctx, params)
if err != nil && strings.Contains(err.Error(), "qlog reader") {
// degrade gracefully: report search unavailable, keep other API working
} Prevention
- Don't downgrade below the query-log format version
- Archive/delete corrupted rotated files
- Alert on search endpoint failures to catch corruption early
When it happens
Trigger: Performing a query-log search when the log files are unreadable (permissions), corrupted (not valid line-delimited JSON), or in a newer format the reader cannot parse after a downgrade.
Common situations: Downgrading to an older version that can't read a newer query-log format; partially written/corrupted log after a crash; file permissions changed after restart; empty-but-locked files on Windows.
Related errors
- interface %s has no ipv6 addresses
- invalid ip version %d
- could not find hardware port for %s
- networksetup failed to set dns servers: %w
- networksetup failed to configure dns servers: %w
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/2740967be244c45b.
Report an issue: GitHub.