AdguardTeam/AdGuardHome · error

start %s is greater or equal to %s

Error message

start %s is greater or equal to %s

What it means

Thrown by the schedule package when validating a day/time range: the range's start value is greater than or equal to maxDayRange (the maximum allowed offset within a day). The validate function runs during UnmarshalJSON/UnmarshalYAML, so malformed schedule configuration fails at parse time.

Source

Thrown at internal/schedule/schedule.go:313

	// end is an offset from the beginning of the day.  It must be greater than
	// 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. Check the parsed start value and unit; ensure start < 24h-equivalent maxDayRange
  2. Make sure start < end and both use the same time unit as the library expects
  3. Validate config with a schema/lint step before unmarshaling

Example fix

// before
{"start": "25h", "end": "26h"}
// after
{"start": "01:00", "end": "02:00"}
Defensive patterns

Strategy: validation

Validate before calling

if r.Start >= 24*time.Hour { return fmt.Errorf("start %s exceeds day range", r.Start) }
var s schedule.Schedule // ...
if err := json.Unmarshal(data, &s); err != nil { /* handle */ }

Type guard

func validRange(s, e, max time.Duration) bool { return s >= 0 && e > s && e <= max }

Try / catch

if err := json.Unmarshal(cfg, &sched); err != nil { log.Printf("bad schedule: %v", err) }

Prevention

When it happens

Trigger: Deserializing a schedule (JSON or YAML) where the range start is >= maxDayRange, e.g. a start offset beyond the end of the day (typically >= 24h in the underlying unit).

Common situations: Typos in schedule config files, confusing seconds/minutes/hours units, or copying a range from a different format where start was meant to be small.

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