{"record":{"id":"f33e052aeb9a62cf","repo":"hashicorp/nomad","slug":"invalid-end-time-in-schedule-q-w","errorCode":null,"errorMessage":"invalid end time in schedule: %q; %w","messagePattern":"invalid end time in schedule: %q; %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/task_sched.go","lineNumber":141,"sourceCode":"\nfunc (t TaskScheduleCron) Next(from time.Time) (time.Duration, time.Duration, error) {\n\t// where are we?\n\tlocation, err := time.LoadLocation(t.GetTimezone())\n\tif err != nil {\n\t\treturn 0, 0, fmt.Errorf(\"invalid timezone in schedule: %w\", err)\n\t}\n\tfrom = from.In(location)\n\n\t// values should be pre-validated by this point\n\tstart, err := cronexpr.Parse(t.Start)\n\tif err != nil {\n\t\treturn 0, 0, fmt.Errorf(\"invalid start time in schedule: %q; %w\", t.Start, err)\n\t}\n\t// get end time for prev to see if we're within the run schedule,\n\t// and from next to get the next pause time.\n\tend, err := cronexpr.Parse(t.End + \" * * * *\") // TODO: if we want to exclude seconds, prefix \"* \" + t.End here\n\tif err != nil {\n\t\treturn 0, 0, fmt.Errorf(\"invalid end time in schedule: %q; %w\", t.End, err)\n\t}\n\n\tstartNext := start.Next(from)\n\t// we'll check the previous start to see if we are currently between it\n\t// and the previous run's end, i.e. it should be running right now!\n\tstartPrev := start.Next(from.Add(-24 * time.Hour))\n\n\t// generate ends from starts, so they always come after\n\tendNext := end.Next(startNext)\n\tendPrev := end.Next(startPrev)\n\n\t// next end must be on the same day as next start\n\tif endNext.Day() > startNext.Day() {\n\t\treturn 0, 0, fmt.Errorf(\"end cannot be sooner than start; end=%q, start=%q\", endNext, startNext)\n\t}\n\n\t// we're in the midst of it right now!\n\tif startPrev.Before(from) && endPrev.After(from) {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/task_sched.go#L123-L159","documentation":"Runtime error in TaskScheduleCron.Next: cronexpr.Parse rejects the cron.end expression (Nomad appends \" * * * *\" to build the full pause-time expression). The 2-field end value is invalid for the parser.","triggerScenarios":"Thrown at nomad/structs/task_sched.go:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix cron.end so the padded expression parses (valid hour/dom values)","Use a simple end like \"17 *\" for 5pm daily"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}