jaegertracing/jaeger · error

duration Minimum is above Maximum

Error message

duration Minimum is above Maximum

What it means

ErrDurationMinGreaterThanMax is returned by validateQuery when DurationMin > DurationMax in the TraceQueryParams. Duration filters translate into CQL range conditions; an inverted duration range can never match, so the reader rejects the query with this sentinel error before touching the database.

Source

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

		FROM duration_index
		WHERE bucket = ? AND service_name = ? AND operation_name = ? AND duration >= ? AND duration <= ?
		LIMIT ?`

	defaultNumTraces = 100
	// limitMultiple exists because many spans that are returned from indices can have the same trace, limitMultiple increases
	// the number of responses from the index, so we can respect the user's limit value they provided.
	limitMultiple = 3
)

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

View on GitHub (pinned to 806f444784)

Solutions

  1. Swap DurationMin and DurationMax so DurationMin <= DurationMax before the call.
  2. Validate/normalize the duration range at the API boundary and reject or auto-correct inverted ranges.
  3. Check code that mutates the params struct to ensure both duration bounds are updated consistently.

Example fix

// before
q.DurationMin, q.DurationMax = 5*time.Second, 1*time.Second
// after
if q.DurationMin > q.DurationMax { q.DurationMin, q.DurationMax = q.DurationMax, q.DurationMin }
Defensive patterns

Strategy: validation

Validate before calling

if q.DurationMin != 0 && q.DurationMax != 0 && q.DurationMin > q.DurationMax {
    return errors.New("duration min must be <= duration max")
}

Try / catch

ids, err := reader.FindTraceIDs(ctx, q)
if errors.Is(err, spanstore.ErrDurationMinGreaterThanMax) {
    return errors.New("invalid duration range")
}

Prevention

When it happens

Trigger: FindTraces/FindTraceIDs called with TraceQueryParams where both DurationMin and DurationMax are non-zero and DurationMin > DurationMax.

Common situations: A UI letting users type min/max duration without ordering enforcement; a client swapping fields when constructing the request; programmatic callers reusing a params struct and only updating one of the two duration fields.

Related errors


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