jaegertracing/jaeger · error

duration Minimum is above Maximum

Error message

duration Minimum is above Maximum

What it means

ErrDurationMinGreaterThanMax is a sentinel error returned by validateQuery when a trace query's minimum duration is greater than its maximum duration. Such a range filter (duration_min > duration_max) can never match any span, so the reader rejects it before querying Elasticsearch. It is asserted in TestTraceQueryParameterValidation as part of the documented validation contract.

Solutions

  1. Swap the values so DurationMin <= DurationMax.
  2. Validate the duration ordering in your caller before building TraceQueryParameters.
  3. If only one bound is needed, leave the other at its zero value instead of duplicating a bound.

Example fix

// before
params := v2api.TraceQueryParameters{DurationMin: 3600e6, DurationMax: 60e6}
// after
if params.DurationMin > params.DurationMax {
    params.DurationMin, params.DurationMax = params.DurationMax, params.DurationMin
}
Defensive patterns

Strategy: validation

Validate before calling

func validateDurationRange(p *api.TraceQueryParameters) error {
    if p.DurationMin > 0 && p.DurationMax > 0 && p.DurationMin > p.DurationMax {
        p.DurationMin, p.DurationMax = p.DurationMax, p.DurationMin
    }
    return nil
}

Try / catch

ids, err := reader.FindTraceIDs(ctx, query)
if errors.Is(err, core.ErrDurationMinGreaterThanMax) {
    return http.StatusBadRequest // inverted duration bounds
}

Prevention

When it happens

Trigger: Calling reader.FindTraceIDs/FindTraces with TraceQueryParameters where DurationMin > DurationMax (e.g. DurationMin=1h, DurationMax=1m). validateQuery performs this comparison after the start-time checks and returns this error.

Common situations: UIs letting users set 'slower than X' and 'faster than Y' bounds without checking ordering; unit mix-ups (milliseconds vs microseconds) producing inverted bounds; copy-paste errors when filling query structs.

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/d3383508ef78e119. Report an issue: GitHub.

Appendix: source

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

	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}

	_ Reader = (*SpanReader)(nil) // check API conformance
)

View on GitHub (pinned to 806f444784)