AdguardTeam/AdGuardHome · error

end %s is greater than %s

Error message

end %s is greater than %s

What it means

The schedule validator rejects a range whose end value exceeds maxDayRange, i.e. the range extends past the end of the day. It surfaces from UnmarshalJSON/UnmarshalYAML when the schedule is parsed.

Source

Thrown at internal/schedule/schedule.go:315

	// or equal to zero and less than or equal to 24h.
	end time.Duration
}

// validate returns the day range validation errors, if any.
func (r dayRange) validate() (err error) {
	switch {
	case r == dayRange{}:
		return nil
	case r.start < 0:
		return fmt.Errorf("start %s is negative", r.start)
	case r.end < 0:
		return fmt.Errorf("end %s is negative", r.end)
	case r.start >= r.end:
		return fmt.Errorf("start %s is greater or equal to end %s", r.start, r.end)
	case r.start >= maxDayRange:
		return fmt.Errorf("start %s is greater or equal to %s", r.start, maxDayRange)
	case r.end > maxDayRange:
		return fmt.Errorf("end %s is greater than %s", r.end, maxDayRange)
	default:
		return nil
	}
}

// contains returns true if start <= offset < end, where offset is the time
// duration from the beginning of the day.
func (r *dayRange) contains(offset time.Duration) (ok bool) {
	return r.start <= offset && offset < r.end
}

// toDayConfigJSON returns nil if the day range is empty, otherwise returns
// initialized JSON configuration of the day range.
func (r dayRange) toDayConfigJSON() (j *dayConfigJSON) {
	if (r == dayRange{}) {
		return nil
	}

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Split ranges crossing midnight into two ranges (e.g. 22:00–24:00 and 00:00–06:00)
  2. Verify the end value's unit matches the library's expectation and is <= maxDayRange
  3. Add a config pre-check that clamps or rejects out-of-day ranges

Example fix

// before
{"start": "22:00", "end": "30:00"}
// after
[{"start": "22:00", "end": "24:00"}, {"start": "00:00", "end": "06:00"}]
Defensive patterns

Strategy: validation

Validate before calling

const day = 24 * time.Hour
if r.End > day { return fmt.Errorf("end %s exceeds day; split overnight ranges", r.End) }

Type guard

func withinDay(d time.Duration) bool { return d <= 24*time.Hour }

Try / catch

if err := yaml.Unmarshal(cfg, &sched); err != nil { return fmt.Errorf("schedule config: %w", err) }

Prevention

When it happens

Trigger: Unmarshaling a schedule where end > maxDayRange (e.g. end offset larger than 24 hours / the day boundary the library enforces).

Common situations: Overnight ranges written as end > 24h instead of being split into two ranges; unit mismatches (minutes vs hours) in config files.

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/e8e2984e98fe6530. Report an issue: GitHub.