Billionmail/BillionMail · error
invalid end_date: %v
Error message
invalid end_date: %v
What it means
Identical to the start_date check but for end_date: time.Parse with layout '2006-01-02' fails and the error is wrapped as 'invalid end_date: %v'. After both parse, an inverted range is rejected separately ('end_date must not be before start_date').
Source
Thrown at core/internal/controller/operation_log/operation_log_v1_get_output_log.go:117
}
func reverseLines(lines []string) {
for i, j := 0, len(lines)-1; i < j; i, j = i+1, j-1 {
lines[i], lines[j] = lines[j], lines[i]
}
}
func getLogFilesInRange(ctx context.Context, start, end string) ([]string, error) {
logDir := public.AbsPath("../logs/core/out")
layout := "2006-01-02"
startDate, err := time.Parse(layout, start)
if err != nil {
return nil, fmt.Errorf("invalid start_date: %v", err)
}
endDate, err := time.Parse(layout, end)
if err != nil {
return nil, fmt.Errorf("invalid end_date: %v", err)
}
if endDate.Before(startDate) {
return nil, fmt.Errorf("end_date must not be before start_date")
}
var files []string
for d := startDate; !d.After(endDate); d = d.AddDate(0, 0, 1) {
fname := filepath.Join(logDir, d.Format("2006-01-02")+".log")
if _, err := os.Stat(fname); err == nil {
files = append(files, fname)
}
}
if len(files) == 0 {
return nil, fmt.Errorf("no log files found")
}
return files, nilView on GitHub (pinned to fc36c76c05)
Solutions
- Format end_date strictly as YYYY-MM-DD.
- Ensure end_date >= start_date so the follow-on range check does not fire either.
- Validate both dates client-side with a strict regex (^\d{4}-\d{2}-\d{2}$) before the call.
Example fix
// before
{"start_date":"2026-08-01","end_date":""}
// after
{"start_date":"2026-08-01","end_date":"2026-09-05"} Defensive patterns
Strategy: validation
Validate before calling
function isValidDate(s) {
if (!/^\d{4}-\d{2}-\d{2}$/.test(s)) return false;
const d = new Date(s + 'T00:00:00Z');
return !isNaN(d.getTime()) && d.toISOString().slice(0, 10) === s;
}
if (!isValidDate(endDate) || endDate < startDate) throw new Error('end_date must be valid YYYY-MM-DD and not before start_date'); Try / catch
try {
return await api.getOutputLog({startDate, endDate})
} catch (e) {
if (/invalid end_date/.test(e.message)) {
throw new UserInputError('end_date must match YYYY-MM-DD')
}
throw e
} Prevention
- Default end_date to today (YYYY-MM-DD) when the field is blank.
- Validate both bounds and their ordering together before the request.
- Strip any time component from datetime inputs for the end bound.
When it happens
Trigger: Calling GetOutputLog with an end_date not in YYYY-MM-DD form: empty string, slashes, ISO datetime, or typo like '2026-9-5'.
Common situations: Client sends 'now' literal or datetime string for the end bound; locale-formatted dates; the end date field left blank while start_date is filled.
Related errors
- invalid start_date: %v
- required column 'email' not found
- You cannot create more than 5000 batches
- No log files found in the given date range
- end_date must not be before start_date
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/276e16e08c4cf0df.
Report an issue: GitHub.