{"record":{"id":"1da8230e87a45713","repo":"jaegertracing/jaeger","slug":"start-and-end-time-must-be-set-1da823","errorCode":null,"errorMessage":"start and End Time must be set","messagePattern":"start and End Time must be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/elasticsearch/tracestore/core/reader.go","lineNumber":65,"sourceCode":"\terrorTag               = \"error\"\n\n\tdefaultSearchDepth = 100\n\n\tDawnOfTimeSpanAge = time.Hour * 24 * 365 * 50\n)\n\nvar (\n\t// ErrStartTimeMinGreaterThanMax occurs when start time min is above start time max\n\tErrStartTimeMinGreaterThanMax = errors.New(\"start Time Minimum is above Maximum\")\n\n\t// ErrDurationMinGreaterThanMax occurs when duration min is above duration max\n\tErrDurationMinGreaterThanMax = errors.New(\"duration Minimum is above Maximum\")\n\n\t// ErrMalformedRequestObject occurs when a request object is nil\n\tErrMalformedRequestObject = errors.New(\"malformed request object\")\n\n\t// ErrStartAndEndTimeNotSet occurs when start time and end time are not set\n\tErrStartAndEndTimeNotSet = errors.New(\"start and End Time must be set\")\n\n\t// ErrUnableToFindTraceIDAggregation occurs when an aggregation query for TraceIDs fail.\n\tErrUnableToFindTraceIDAggregation = errors.New(\"could not find aggregation of traceIDs\")\n\n\tdefaultMaxDuration = model.DurationAsMicroseconds(time.Hour * 24)\n\n\tobjectTagFieldList = []string{objectTagsField, objectProcessTagsField}\n\n\tnestedTagFieldList = []string{nestedTagsField, nestedProcessTagsField, nestedLogFieldsField}\n\n\t_ Reader = (*SpanReader)(nil) // check API conformance\n)\n\n// Time-range design (referenced as \"timeRangeDesign\" in comments below):\n//\n// There are two read operations with different time-range semantics:\n//\n//  1. FindTraceIDs: the user always supplies [StartTimeMin, StartTimeMax]. No adjustment needed.","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/elasticsearch/tracestore/core/reader.go#L47-L83","documentation":"ErrStartAndEndTimeNotSet is a sentinel error returned by validateQuery when neither StartTimeMin nor StartTimeMax is provided in a time-based trace query. The reader requires an explicit time window to construct the Elasticsearch range filter, so it refuses the query when both bounds are absent.","triggerScenarios":"Calling reader.FindTraceIDs/FindTraces with TraceQueryParameters where both StartTimeMin and StartTimeMax are zero values (unset), typically when intending to query 'all traces'. validateQuery returns this error instead of issuing an unbounded scan.","commonSituations":"Leaving time fields at their zero value when copying the query struct; UIs that omit defaults; assuming an empty time range means 'no time filter' when the API actually requires explicit bounds.","solutions":["Set both StartTimeMin and StartTimeMax to an explicit window (e.g. last 24h) before querying.","Default the window in your caller: StartTimeMax=now, StartTimeMin=now-lookback.","If you need unbounded queries, iterate over bounded windows instead."],"exampleFix":"// before\nparams := v2api.TraceQueryParameters{ServiceName: \"svc\"} // times unset\n// after\nnow := time.Now()\nparams := v2api.TraceQueryParameters{ServiceName: \"svc\", StartTimeMin: now.Add(-24 * time.Hour), StartTimeMax: now}","handlingStrategy":"validation","validationCode":"func ensureTimeWindow(p *api.TraceQueryParameters, lookback time.Duration) {\n    if p.StartTimeMin.IsZero() || p.StartTimeMax.IsZero() {\n        p.StartTimeMax = time.Now()\n        p.StartTimeMin = p.StartTimeMax.Add(-lookback)\n    }\n}","typeGuard":null,"tryCatchPattern":"ids, err := reader.FindTraceIDs(ctx, query)\nif errors.Is(err, core.ErrStartAndEndTimeNotSet) {\n    return http.StatusBadRequest // time window required\n}","preventionTips":["Always set an explicit time window; default to a bounded lookback (e.g. 24h).","Do not assume empty times mean 'no filter' — this API requires explicit bounds.","Chunk large time ranges into windows to avoid unbounded scans."],"tags":["elasticsearch","query-validation","missing-fields"],"backgroundTag":"missing-required-argument","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}