jaegertracing/jaeger · error
malformed request object
Error message
malformed request object
What it means
ErrMalformedRequestObject is returned by validateQuery when the *spanstore.TraceQueryParameters pointer passed to FindTraces/FindTraceIDs is nil. A nil query object has no bounds or filters at all, so the reader refuses it instead of panicking on field access.
Source
Thrown at internal/storage/v1/badger/spanstore/reader.go:37
"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 (
defaultNumTraces = 100
sizeOfTraceID = 16
encodingTypeBits = 0x0FView on GitHub (pinned to 806f444784)
Solutions
- Always pass a non-nil *spanstore.TraceQueryParameters; use an empty struct for 'match everything recent'.
- Check for nil in your caller before invoking the reader and return a client-side validation error.
- At an API boundary, default an empty request to &spanstore.TraceQueryParameters{StartTimeMin: ..., StartTimeMax: ...} with sane bounds.
Example fix
// before
ids, err := reader.FindTraceIDs(ctx, nil)
// after
if query == nil {
query = &spanstore.TraceQueryParameters{
StartTimeMin: time.Now().Add(-time.Hour),
StartTimeMax: time.Now(),
}
}
ids, err := reader.FindTraceIDs(ctx, query) Defensive patterns
Strategy: validation
Validate before calling
if q == nil {
return errors.New("trace query parameters must not be nil")
} Type guard
func isUsableQuery(q *spanstore.TraceQueryParameters) bool {
return q != nil
} Try / catch
ids, err := reader.FindTraceIDs(ctx, q)
if errors.Is(err, spanstore.ErrMalformedRequestObject) {
return nil, httpError(400, "missing query parameters")
}
if err != nil { return nil, err } Prevention
- Never pass a nil *TraceQueryParameters; default to an empty struct with explicit time bounds.
- Default an empty/missing request body to a sensible query at the API boundary.
- Handle decode/bind failures before constructing the storage query so nils cannot leak through.
When it happens
Trigger: Calling FindTraceIDs(ctx, nil) or FindTraces(ctx, nil) directly — most often from hand-written integrations or test code that builds the request conditionally and skips the nil case.
Common situations: Wrappers that pass through a decoded request body which failed to bind; generic adapters constructing the params only when filters exist; unit tests passing nil expecting an empty result.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- service name must be set
- min start time is above max
- min duration is above max
- start and end time must be set
- could not find aggregation of traceIDs
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/a2e45849a9b03e02.
Report an issue: GitHub.