jaegertracing/jaeger · error

start Time Minimum is above Maximum

Error message

start Time Minimum is above Maximum

What it means

ErrStartTimeMinGreaterThanMax is a sentinel error returned by validateQuery in the Elasticsearch trace reader when a trace query's start-time range is inverted: the minimum (earlier-bound) time is later than the maximum (later-bound) time. The library rejects such queries up front rather than issuing a range filter that can never match. It is also asserted in TestTraceQueryParameterValidation to document this validation contract.

Source

Thrown at internal/storage/v2/elasticsearch/tracestore/core/reader.go:56

	operationNameField     = "operationName"
	parentSpanIDField      = "parentSpanID"
	objectTagsField        = "tag"
	objectProcessTagsField = "process.tag"
	nestedTagsField        = "tags"
	nestedProcessTagsField = "process.tags"
	nestedLogFieldsField   = "logs.fields"
	tagKeyField            = "key"
	tagValueField          = "value"
	errorTag               = "error"

	defaultSearchDepth = 100

	DawnOfTimeSpanAge = time.Hour * 24 * 365 * 50
)

var (
	// 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")

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

	// ErrUnableToFindTraceIDAggregation occurs when an aggregation query for TraceIDs fail.
	ErrUnableToFindTraceIDAggregation = errors.New("could not find aggregation of traceIDs")

	defaultMaxDuration = model.DurationAsMicroseconds(time.Hour * 24)

	objectTagFieldList = []string{objectTagsField, objectProcessTagsField}

	nestedTagFieldList = []string{nestedTagsField, nestedProcessTagsField, nestedLogFieldsField}

View on GitHub (pinned to 806f444784)

Solutions

  1. Swap the values so StartTimeMin is the earlier time and StartTimeMax is the later time.
  2. Validate the time range in your caller before invoking the reader (return a 400 to users with an inverted range).
  3. If you intended a duration-style query, use the Duration fields instead of the start/end time fields.

Example fix

// before
params := v2api.TraceQueryParameters{StartTimeMin: tMax, StartTimeMax: tMin}
// after
if tMin.After(tMax) { tMin, tMax = tMax, tMin }
params := v2api.TraceQueryParameters{StartTimeMin: tMin, StartTimeMax: tMax}
Defensive patterns

Strategy: validation

Validate before calling

func validateTimeRange(p *api.TraceQueryParameters) error {
    if p == nil { return errors.New("nil params") }
    if p.StartTimeMin.After(p.StartTimeMax) {
        return errors.New("StartTimeMin must be <= StartTimeMax")
    }
    return nil
}
if err := validateTimeRange(&params); err != nil { /* handle before calling reader */ }

Try / catch

traces, err := reader.FindTraces(ctx, query)
if errors.Is(err, core.ErrStartTimeMinGreaterThanMax) {
    return http.StatusBadRequest // inverted time range
}

Prevention

When it happens

Trigger: Calling reader.FindTraceIDs/FindTraces with a TraceQueryParameters whose StartTimeMin is after StartTimeMax (e.g. StartTimeMin=now, StartTimeMax=now-1h). validateQuery compares the two times before building the Elasticsearch query and returns this error.

Common situations: Swapping the order of start/end arguments when constructing query parameters; UI code computing min/max from user input where the user picks an inverted date range; timezone conversion mistakes that shift the 'min' past the 'max'.

Understand the failure class

Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.

Related errors


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