jaegertracing/jaeger · error

min duration is above max

Error message

min duration is above max

What it means

ErrDurationMinGreaterThanMax is returned by validateQuery when TraceQueryParameters sets both DurationMin and DurationMax with DurationMin > DurationMax. The duration filter is implemented as a hash-join over index entries, so a contradictory duration window is rejected during validation.

Source

Thrown at internal/storage/v1/badger/spanstore/reader.go:34

	"github.com/dgraph-io/badger/v4"
	"golang.org/x/exp/maps"

	"github.com/jaegertracing/jaeger-idl/model/v1"
	"github.com/jaegertracing/jaeger/internal/storage/v1/api/spanstore"
	"github.com/jaegertracing/jaeger/internal/storage/v2/api/tracestore"
)

// Most of these errors are common with the ES and Cassandra backends. Each backend has slightly different validation rules.

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("min start time is above max")

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

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

	// ErrNotSupported during development, don't support every option - yet
	ErrNotSupported = errors.New("this query parameter is not supported yet")

	// ErrInternalConsistencyError indicates internal data consistency issue
	ErrInternalConsistencyError = errors.New("internal data consistency issue")
)

const (

View on GitHub (pinned to 806f444784)

Solutions

  1. Correct the values so DurationMin <= DurationMax before querying.
  2. Only set both fields when a bounded range is intended; leave DurationMax (or DurationMin) at 0 for one-sided filters.
  3. Normalize units (use time.Duration everywhere) so ms/s confusion cannot invert the range.

Example fix

// before
q := &spanstore.TraceQueryParameters{DurationMin: 5 * time.Second, DurationMax: 2 * time.Second}
// after
q := &spanstore.TraceQueryParameters{DurationMin: 2 * time.Second, DurationMax: 5 * time.Second}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func hasValidDurationRange(q *spanstore.TraceQueryParameters) bool {
	return q == nil || q.DurationMin == 0 || q.DurationMax == 0 || q.DurationMin <= q.DurationMax
}

Try / catch

ids, err := reader.FindTraceIDs(ctx, q)
if errors.Is(err, spanstore.ErrDurationMinGreaterThanMax) {
	return nil, httpError(400, "duration filter is inverted: min exceeds max")
}
if err != nil { return nil, err }

Prevention

When it happens

Trigger: FindTraceIDs/FindTraces with DurationMin and DurationMax both non-zero and DurationMin > DurationMax — e.g. 'at least 5s' combined with 'at most 2s'.

Common situations: UI duration filters where the min/max inputs are filled in the wrong boxes; programmatic callers swapping duration units (ms vs s) so min numerically exceeds max; copy-paste of filter values.

Related errors


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