jaegertracing/jaeger · error

start and End Time must be set

Error message

start and End Time must be set

What it means

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.

Source

Thrown at internal/storage/v1/cassandra/spanstore/reader.go:81

var (
	// ErrServiceNameNotSet occurs when attempting to query with an empty service name
	ErrServiceNameNotSet = errors.New("service Name must be set")

	// ErrStartTimeMinGreaterThanMax occurs when start time min is above start time max
	ErrStartTimeMinGreaterThanMax = errors.New("start Time Minimum is above Maximum")

	// ErrDurationMinGreaterThanMax occurs when duration min is above duration max
	ErrDurationMinGreaterThanMax = errors.New("duration Minimum is above Maximum")

	// ErrMalformedRequestObject occurs when a request object is nil
	ErrMalformedRequestObject = errors.New("malformed request object")

	// ErrDurationAndTagQueryNotSupported occurs when duration and tags are both set
	ErrDurationAndTagQueryNotSupported = errors.New("cannot query for duration and tags simultaneously")

	// ErrStartAndEndTimeNotSet occurs when start time and end time are not set
	ErrStartAndEndTimeNotSet = errors.New("start and End Time must be set")
)

type serviceNamesReader func() ([]string, error)

type operationNamesReader func(query tracestore.OperationQueryParams) ([]tracestore.Operation, error)

type spanReaderMetrics struct {
	readTraces                 *casmetrics.Table
	queryTrace                 *casmetrics.Table
	queryTagIndex              *casmetrics.Table
	queryDurationIndex         *casmetrics.Table
	queryServiceOperationIndex *casmetrics.Table
	queryServiceNameIndex      *casmetrics.Table
}

// CoreSpanReader is the primary Cassandra span reader that returns raw database
// model types (dbmodel.*) without any conversion to external API types. It serves
// as the foundation for the v2 tracestore.TraceReader, which wraps CoreSpanReader

View on GitHub (pinned to 806f444784)

Solutions

  1. Set both StartTimeMin and StartTimeMax explicitly (e.g. max and max minus the desired lookback) before calling FindTraces.
  2. Add caller-side defaults: if either bound is zero, fill it from the configured default lookback window.
  3. Validate incoming API requests so missing time bounds are rejected or defaulted at the boundary.

Example fix

// before
q := &tracestore.TraceQueryParams{ServiceName: svc}
// after
now := time.Now()
q := &tracestore.TraceQueryParams{ServiceName: svc, StartTimeMin: now.Add(-time.Hour), StartTimeMax: now}
Defensive patterns

Strategy: validation

Validate before calling

if q.StartTimeMin.IsZero() || q.StartTimeMax.IsZero() {
    now := time.Now()
    if q.StartTimeMin.IsZero() { q.StartTimeMin = now.Add(-defaultLookback) }
    if q.StartTimeMax.IsZero() { q.StartTimeMax = now }
}

Try / catch

ids, err := reader.FindTraceIDs(ctx, q)
if errors.Is(err, spanstore.ErrStartAndEndTimeNotSet) {
    return errors.New("time range is required for trace search")
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/75ba443fc6de17d5. Report an issue: GitHub.