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

  1. Check the wrapped error for the offending file and OS/parse cause
  2. Repair or delete corrupted rotated log files so the reader can proceed
  3. Align versions (don't downgrade below the log format version) or archive old logs elsewhere
  4. 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

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


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/2740967be244c45b. Report an issue: GitHub.