{"record":{"id":"75ba443fc6de17d5","repo":"jaegertracing/jaeger","slug":"start-and-end-time-must-be-set-75ba44","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/v1/cassandra/spanstore/reader.go","lineNumber":81,"sourceCode":"\nvar (\n\t// ErrServiceNameNotSet occurs when attempting to query with an empty service name\n\tErrServiceNameNotSet = errors.New(\"service Name must be set\")\n\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// ErrDurationAndTagQueryNotSupported occurs when duration and tags are both set\n\tErrDurationAndTagQueryNotSupported = errors.New(\"cannot query for duration and tags simultaneously\")\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\ntype serviceNamesReader func() ([]string, error)\n\ntype operationNamesReader func(query tracestore.OperationQueryParams) ([]tracestore.Operation, error)\n\ntype spanReaderMetrics struct {\n\treadTraces                 *casmetrics.Table\n\tqueryTrace                 *casmetrics.Table\n\tqueryTagIndex              *casmetrics.Table\n\tqueryDurationIndex         *casmetrics.Table\n\tqueryServiceOperationIndex *casmetrics.Table\n\tqueryServiceNameIndex      *casmetrics.Table\n}\n\n// CoreSpanReader is the primary Cassandra span reader that returns raw database\n// model types (dbmodel.*) without any conversion to external API types. It serves\n// as the foundation for the v2 tracestore.TraceReader, which wraps CoreSpanReader","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v1/cassandra/spanstore/reader.go#L63-L99","documentation":"ErrStartAndEndTimeNotSet is returned by validateQuery when either StartTimeMin or StartTimeMax is the zero time.Time. The Cassandra search path always needs a time range to bound the query, so queries missing either bound are rejected with this sentinel error.","triggerScenarios":"FindTraces/FindTraceIDs called with TraceQueryParams where p.StartTimeMin.IsZero() || p.StartTimeMax.IsZero() — e.g. a caller that sets service name and filters but forgets the lookback window, relying on the backend to default it.","commonSituations":"Clients ported from backends that defaulted the time window; request structs deserialized from JSON where the time fields were absent and left as zero values; programmatic callers assuming 'now' defaults.","solutions":["Set both StartTimeMin and StartTimeMax explicitly (e.g. max and max minus the desired lookback) before calling FindTraces.","Add caller-side defaults: if either bound is zero, fill it from the configured default lookback window.","Validate incoming API requests so missing time bounds are rejected or defaulted at the boundary."],"exampleFix":"// before\nq := &tracestore.TraceQueryParams{ServiceName: svc}\n// after\nnow := time.Now()\nq := &tracestore.TraceQueryParams{ServiceName: svc, StartTimeMin: now.Add(-time.Hour), StartTimeMax: now}","handlingStrategy":"validation","validationCode":"if q.StartTimeMin.IsZero() || q.StartTimeMax.IsZero() {\n    now := time.Now()\n    if q.StartTimeMin.IsZero() { q.StartTimeMin = now.Add(-defaultLookback) }\n    if q.StartTimeMax.IsZero() { q.StartTimeMax = now }\n}","typeGuard":null,"tryCatchPattern":"ids, err := reader.FindTraceIDs(ctx, q)\nif errors.Is(err, spanstore.ErrStartAndEndTimeNotSet) {\n    return errors.New(\"time range is required for trace search\")\n}","preventionTips":["Apply a default lookback window in a query-builder constructor so time bounds are never zero.","Validate incoming requests so missing time fields are defaulted or rejected at the boundary.","Never deserialize TraceQueryParams directly from unvalidated JSON."],"tags":["cassandra","query-validation","time-range"],"backgroundTag":"missing-required-argument","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}