jaegertracing/jaeger · error

malformed request object

Error message

malformed request object

What it means

ErrMalformedRequestObject is returned by validateQuery when the TraceQueryParams pointer passed to FindTraces/FindTraceIDs is nil. There is nothing to validate or query against, so the reader fails immediately with this sentinel error rather than panicking on a nil dereference.

Source

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

	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
	queryTagIndex              *casmetrics.Table
	queryDurationIndex         *casmetrics.Table
	queryServiceOperationIndex *casmetrics.Table

View on GitHub (pinned to 806f444784)

Solutions

  1. Ensure the caller always constructs a non-nil *tracestore.TraceQueryParams before invoking FindTraces/FindTraceIDs.
  2. Nil-check the query at the call site and return a client-facing error or an empty result instead of passing nil down.
  3. If params can be legitimately absent, default-construct an empty struct and let the other validation errors explain what is missing.

Example fix

// before
reader.FindTraceIDs(ctx, query) // query may be nil
// after
if query == nil { return nil, errors.New("nil trace query") }
reader.FindTraceIDs(ctx, query)
Defensive patterns

Strategy: type-guard

Validate before calling

if query == nil {
    return errors.New("trace query must not be nil")
}

Type guard

func validQuery(q *tracestore.TraceQueryParams) bool { return q != nil }

Try / catch

ids, err := reader.FindTraceIDs(ctx, q)
if errors.Is(err, spanstore.ErrMalformedRequestObject) {
    return errors.New("no trace query provided")
}

Prevention

When it happens

Trigger: Calling SpanReader.FindTraces(ctx, nil) or FindTraceIDs(ctx, nil) — typically from a code path that skips building the query object when optional filters are absent, or an uninitialized struct pointer.

Common situations: Custom query-service plugins calling the storage layer directly; reflection/config-driven construction that leaves the params nil; tests or glue code forgetting to allocate the struct.

Understand the failure class

Related errors


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