AdguardTeam/AdGuardHome · error

found no dns servers in %s

Error message

found no dns servers in %s

What it means

When unmarshalling a WeeklySchedule from JSON, each weekday's dayRange is validated. If any day's range is invalid (negative times, start >= end, sub-minute precision, out-of-day bounds), UnmarshalJSON returns 'weekday <Day>: <cause>'. This happens during config load.

Source

Thrown at internal/aghnet/net_darwin.go:214

	_, 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. Read the weekday and wrapped cause in the message to locate the bad day and rule
  2. Fix start/end to non-negative minute-rounded values with start < end within one day
  3. Validate the schedule with a JSON schema or the UI before writing it to config
  4. Regenerate schedules from your tooling using minute-precision durations

Example fix

// before
{"mon":{"start":"-3600000000000","end":"36000000000000"}}
// after
{"mon":{"start":0,"end":36000000000000}} // start >= 0, minute-aligned
Defensive patterns

Strategy: validation

Validate before calling

// Validate each day's range before marshalling
for i, d := range days {
    if err := validateDayRange(d); err != nil { return fmt.Errorf("day %d: %w", i, err) }
}

Type guard

func isValidDayRange(start, end time.Duration) bool {
    return (start == 0 && end == 0) ||
        (start >= 0 && end >= 0 && start < end &&
         start%time.Minute == 0 && end%time.Minute == 0 &&
         end <= 24*time.Hour)
}

Try / catch

if err := json.Unmarshal(data, &sched); err != nil {
    if strings.HasPrefix(err.Error(), "weekday ") {
        // locate named day, fix range, re-unmarshal
    }
}

Prevention

When it happens

Trigger: Providing a JSON weekly schedule where at least one day object has start/end values that fail dayRange.validate — e.g. negative milliseconds, start >= end, or second-level precision.

Common situations: Hand-editing the parental-control/schedule JSON; generating schedules from a script that emits seconds or negative values; copying a schedule example from docs of a different version.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


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