{"record":{"id":"47ea831657283a0c","repo":"Billionmail/BillionMail","slug":"invalid-start-date-v","errorCode":null,"errorMessage":"invalid start_date: %v","messagePattern":"invalid start_date: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/controller/operation_log/operation_log_v1_get_output_log.go","lineNumber":113,"sourceCode":"\t\t\tlines = append(lines, line)\n\t\t}\n\t}\n\treturn lines, scanner.Err()\n}\n\nfunc reverseLines(lines []string) {\n\tfor i, j := 0, len(lines)-1; i < j; i, j = i+1, j-1 {\n\t\tlines[i], lines[j] = lines[j], lines[i]\n\t}\n}\n\nfunc getLogFilesInRange(ctx context.Context, start, end string) ([]string, error) {\n\tlogDir := public.AbsPath(\"../logs/core/out\")\n\tlayout := \"2006-01-02\"\n\n\tstartDate, err := time.Parse(layout, start)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid start_date: %v\", err)\n\t}\n\tendDate, err := time.Parse(layout, end)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid end_date: %v\", err)\n\t}\n\tif endDate.Before(startDate) {\n\t\treturn nil, fmt.Errorf(\"end_date must not be before start_date\")\n\t}\n\n\tvar files []string\n\n\tfor d := startDate; !d.After(endDate); d = d.AddDate(0, 0, 1) {\n\t\tfname := filepath.Join(logDir, d.Format(\"2006-01-02\")+\".log\")\n\t\tif _, err := os.Stat(fname); err == nil {\n\t\t\tfiles = append(files, fname)\n\t\t}\n\t}\n","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/controller/operation_log/operation_log_v1_get_output_log.go#L95-L131","documentation":"getLogFilesInRange parses start_date with layout '2006-01-02'; when time.Parse fails it returns 'invalid start_date: %v'. The wrapped value is Go's parsing error, showing the offending value and expected layout.","triggerScenarios":"Calling GetOutputLog with a start_date not matching YYYY-MM-DD: empty string, '09/01/2026', ISO datetime '2026-09-01T00:00:00Z', or unix timestamp.","commonSituations":"Frontend date pickers emitting locale-formatted dates; API clients sending full ISO timestamps; missing query parameter defaulting to empty string.","solutions":["Format start_date strictly as YYYY-MM-DD before calling the API.","Strip the time portion if you have an ISO datetime (take the first 10 characters).","Make the parameter required/validated in the client before submission."],"exampleFix":"// before\nparams.set('start_date', new Date().toISOString())  // 2026-09-05T12:00:00.000Z\n// after\nparams.set('start_date', new Date().toISOString().slice(0, 10))  // 2026-09-05","handlingStrategy":"validation","validationCode":"function isValidDate(s) {\n  if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(s)) return false;\n  const d = new Date(s + 'T00:00:00Z');\n  return !isNaN(d.getTime()) && d.toISOString().slice(0, 10) === s;\n}\nif (!isValidDate(startDate)) throw new Error('start_date must be a valid YYYY-MM-DD date');","typeGuard":null,"tryCatchPattern":"try {\n  return await api.getOutputLog({startDate, endDate})\n} catch (e) {\n  if (/invalid start_date/.test(e.message)) {\n    throw new UserInputError('start_date must match YYYY-MM-DD')\n  }\n  throw e\n}","preventionTips":["Slice ISO datetimes to 10 chars (or format explicitly) before sending as start_date.","Use a date input type that emits YYYY-MM-DD natively.","Unit-test API clients with the exact layout the server expects ('2006-01-02')."],"tags":["validation","dates","api"],"backgroundTag":"invalid-date-format","analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}