jaegertracing/jaeger · error
cannot query for duration and tags simultaneously
Error message
cannot query for duration and tags simultaneously
What it means
ErrDurationAndTagQueryNotSupported is returned by validateQuery when the query sets a duration filter (DurationMin or DurationMax non-zero) and also supplies search attributes/tags. The Cassandra schema indexes tags separately from duration-derived rows, so combining both filters in one query is not supported by this storage backend and is rejected up front.
Source
Thrown at internal/storage/v1/cassandra/spanstore/reader.go:78
// 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
queryTagIndex *casmetrics.Table
queryDurationIndex *casmetrics.Table
queryServiceOperationIndex *casmetrics.Table
queryServiceNameIndex *casmetrics.Table
}
View on GitHub (pinned to 806f444784)
Solutions
- Run the query in two passes: first filter by duration (or tags) via FindTraceIDs, then narrow results by the other criterion in application code.
- Drop one of the two filters if the results of a single filter are sufficient.
- If the combination is a hard requirement, use the Elasticsearch/OpenSearch storage backend, which supports duration+tag queries.
Example fix
// before
q := &tracestore.TraceQueryParams{DurationMin: time.Second, Attributes: tags}
reader.FindTraces(ctx, q) // rejected
// after: query duration first, filter tags client-side
ids, _ := reader.FindTraceIDs(ctx, &tracestore.TraceQueryParams{ServiceName: svc, DurationMin: time.Second, ...})
// then filter matching traces by tags Defensive patterns
Strategy: validation
Validate before calling
if (q.DurationMin != 0 || q.DurationMax != 0) && q.Attributes.Len() > 0 {
return errors.New("cassandra backend: cannot combine duration and tag filters")
} Try / catch
ids, err := reader.FindTraceIDs(ctx, q)
if errors.Is(err, spanstore.ErrDurationAndTagQueryNotSupported) {
// degrade: run one filter, refine client-side, or inform user of backend limit
} Prevention
- Feature-detect storage capabilities and disable combined duration+tag search in the UI for Cassandra backends.
- Split such queries into two passes (duration query, then tag refinement) in a shared search helper.
- Document backend-specific query limitations for API consumers.
When it happens
Trigger: FindTraces/FindTraceIDs called with TraceQueryParams where (DurationMin != 0 || DurationMax != 0) and p.Attributes.Len() > 0 — e.g. a search request like 'duration>1s AND tag http.status_code=500'.
Common situations: UI/API clients composing arbitrary search filters that the storage layer cannot satisfy jointly; feature-parity assumptions between the ES backend (which supports the combination) and the Cassandra backend; plugin code forwarding user filter objects unmodified.
Related errors
- service Name must be set
- start Time Minimum is above Maximum
- duration Minimum is above Maximum
- malformed request object
- start and End Time must be set
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/2ad79825f8bf8085.
Report an issue: GitHub.