{"record":{"id":"b7d3ada35e2e4c62","repo":"AdguardTeam/AdGuardHome","slug":"start-s-is-greater-or-equal-to-s","errorCode":null,"errorMessage":"start %s is greater or equal to %s","messagePattern":"start (.+?) is greater or equal to (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/schedule/schedule.go","lineNumber":313,"sourceCode":"\n\t// end is an offset from the beginning of the day.  It must be greater than\n\t// or equal to zero and less than or equal to 24h.\n\tend time.Duration\n}\n\n// validate returns the day range validation errors, if any.\nfunc (r dayRange) validate() (err error) {\n\tswitch {\n\tcase r == dayRange{}:\n\t\treturn nil\n\tcase r.start < 0:\n\t\treturn fmt.Errorf(\"start %s is negative\", r.start)\n\tcase r.end < 0:\n\t\treturn fmt.Errorf(\"end %s is negative\", r.end)\n\tcase r.start >= r.end:\n\t\treturn fmt.Errorf(\"start %s is greater or equal to end %s\", r.start, r.end)\n\tcase r.start >= maxDayRange:\n\t\treturn fmt.Errorf(\"start %s is greater or equal to %s\", r.start, maxDayRange)\n\tcase r.end > maxDayRange:\n\t\treturn fmt.Errorf(\"end %s is greater than %s\", r.end, maxDayRange)\n\tdefault:\n\t\treturn nil\n\t}\n}\n\n// contains returns true if start <= offset < end, where offset is the time\n// duration from the beginning of the day.\nfunc (r *dayRange) contains(offset time.Duration) (ok bool) {\n\treturn r.start <= offset && offset < r.end\n}\n\n// toDayConfigJSON returns nil if the day range is empty, otherwise returns\n// initialized JSON configuration of the day range.\nfunc (r dayRange) toDayConfigJSON() (j *dayConfigJSON) {\n\tif (r == dayRange{}) {\n\t\treturn nil","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/AdguardTeam/AdGuardHome/blob/b41aefbe51c8dde65e2c50f093996afa0502edf9/internal/schedule/schedule.go#L295-L331","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the parsed start value and unit; ensure start < 24h-equivalent maxDayRange","Make sure start < end and both use the same time unit as the library expects","Validate config with a schema/lint step before unmarshaling"],"exampleFix":"// before\n{\"start\": \"25h\", \"end\": \"26h\"}\n// after\n{\"start\": \"01:00\", \"end\": \"02:00\"}","handlingStrategy":"validation","validationCode":"if r.Start >= 24*time.Hour { return fmt.Errorf(\"start %s exceeds day range\", r.Start) }\nvar s schedule.Schedule // ...\nif err := json.Unmarshal(data, &s); err != nil { /* handle */ }","typeGuard":"func validRange(s, e, max time.Duration) bool { return s >= 0 && e > s && e <= max }","tryCatchPattern":"if err := json.Unmarshal(cfg, &sched); err != nil { log.Printf(\"bad schedule: %v\", err) }","preventionTips":["Use whole-hour HH:MM strings in schedule config","Lint schedule ranges (0 <= start < end <= 24h) before deploy","Unit-test config files by unmarshaling them in CI"],"tags":["schedule","config-validation","time-range"],"backgroundTag":"config-validation-failed","analyzedSha":"b41aefbe51c8dde65e2c50f093996afa0502edf9","analyzedAt":"2026-08-27T04:57:55.097Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}