{"record":{"id":"35dd4a53f22f4f1a","repo":"jaegertracing/jaeger","slug":"malformed-request-object-35dd4a","errorCode":null,"errorMessage":"malformed request object","messagePattern":"malformed request object","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v1/cassandra/spanstore/reader.go","lineNumber":75,"sourceCode":"\n\tdefaultNumTraces = 100\n\t// limitMultiple exists because many spans that are returned from indices can have the same trace, limitMultiple increases\n\t// the number of responses from the index, so we can respect the user's limit value they provided.\n\tlimitMultiple = 3\n)\n\nvar (\n\t// ErrServiceNameNotSet occurs when attempting to query with an empty service name\n\tErrServiceNameNotSet = errors.New(\"service Name must be set\")\n\n\t// ErrStartTimeMinGreaterThanMax occurs when start time min is above start time max\n\tErrStartTimeMinGreaterThanMax = errors.New(\"start Time Minimum is above Maximum\")\n\n\t// ErrDurationMinGreaterThanMax occurs when duration min is above duration max\n\tErrDurationMinGreaterThanMax = errors.New(\"duration Minimum is above Maximum\")\n\n\t// ErrMalformedRequestObject occurs when a request object is nil\n\tErrMalformedRequestObject = errors.New(\"malformed request object\")\n\n\t// ErrDurationAndTagQueryNotSupported occurs when duration and tags are both set\n\tErrDurationAndTagQueryNotSupported = errors.New(\"cannot query for duration and tags simultaneously\")\n\n\t// ErrStartAndEndTimeNotSet occurs when start time and end time are not set\n\tErrStartAndEndTimeNotSet = errors.New(\"start and End Time must be set\")\n)\n\ntype serviceNamesReader func() ([]string, error)\n\ntype operationNamesReader func(query tracestore.OperationQueryParams) ([]tracestore.Operation, error)\n\ntype spanReaderMetrics struct {\n\treadTraces                 *casmetrics.Table\n\tqueryTrace                 *casmetrics.Table\n\tqueryTagIndex              *casmetrics.Table\n\tqueryDurationIndex         *casmetrics.Table\n\tqueryServiceOperationIndex *casmetrics.Table","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v1/cassandra/spanstore/reader.go#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the caller always constructs a non-nil *tracestore.TraceQueryParams before invoking FindTraces/FindTraceIDs.","Nil-check the query at the call site and return a client-facing error or an empty result instead of passing nil down.","If params can be legitimately absent, default-construct an empty struct and let the other validation errors explain what is missing."],"exampleFix":"// before\nreader.FindTraceIDs(ctx, query) // query may be nil\n// after\nif query == nil { return nil, errors.New(\"nil trace query\") }\nreader.FindTraceIDs(ctx, query)","handlingStrategy":"type-guard","validationCode":"if query == nil {\n    return errors.New(\"trace query must not be nil\")\n}","typeGuard":"func validQuery(q *tracestore.TraceQueryParams) bool { return q != nil }","tryCatchPattern":"ids, err := reader.FindTraceIDs(ctx, q)\nif errors.Is(err, spanstore.ErrMalformedRequestObject) {\n    return errors.New(\"no trace query provided\")\n}","preventionTips":["Always allocate TraceQueryParams with a constructor/factory that fills defaults.","Nil-check query params at every public API entry point.","Avoid reflection/config paths that can leave the params pointer nil."],"tags":["cassandra","nil-check","query-validation"],"backgroundTag":"nil-request-object","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}