{"record":{"id":"bcbe65be774a5b12","repo":"jaegertracing/jaeger","slug":"failed-to-execute-gettraces-w","errorCode":null,"errorMessage":"failed to execute GetTraces: %w","messagePattern":"failed to execute GetTraces: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/grpc/tracereader.go","lineNumber":93,"sourceCode":"\nfunc (tr *TraceReader) GetTraces(\n\tctx context.Context,\n\ttraceIDs ...tracestore.GetTraceParams,\n) iter.Seq2[[]ptrace.Traces, error] {\n\treturn func(yield func([]ptrace.Traces, error) bool) {\n\t\tquery := []*storage.GetTraceParams{}\n\t\tfor _, traceID := range traceIDs {\n\t\t\tquery = append(query, &storage.GetTraceParams{\n\t\t\t\tTraceId:   traceID.TraceID[:],\n\t\t\t\tStartTime: traceID.Start,\n\t\t\t\tEndTime:   traceID.End,\n\t\t\t})\n\t\t}\n\t\tstream, err := tr.client.GetTraces(ctx, &storage.GetTracesRequest{\n\t\t\tQuery: query,\n\t\t})\n\t\tif err != nil {\n\t\t\tyield(nil, fmt.Errorf(\"failed to execute GetTraces: %w\", err))\n\t\t\treturn\n\t\t}\n\t\tfor received, err := stream.Recv(); !errors.Is(err, io.EOF); received, err = stream.Recv() {\n\t\t\tif err != nil {\n\t\t\t\tyield(nil, fmt.Errorf(\"received error from grpc stream: %w\", err))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !yield([]ptrace.Traces{received.ToTraces()}, nil) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc (tr *TraceReader) GetServices(ctx context.Context) ([]string, error) {\n\tresp, err := tr.client.GetServices(ctx, &storage.GetServicesRequest{})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to execute GetServices: %w\", err)","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/grpc/tracereader.go#L75-L111","documentation":"Inside the GetTraces iterator, the initial gRPC call to open the GetTraces stream failed; the error is yielded to the push iterator wrapped as 'failed to execute GetTraces'. No traces are delivered and the iteration terminates.","triggerScenarios":"Iterating TraceReader.GetTraces(ctx, traceIDs, query) when the RPC setup fails: server unavailable, deadline exceeded, request rejected (auth/tenancy), or invalid query parameters.","commonSituations":"Remote storage down at query time; context deadline too short for large queries; invalid trace IDs format; tenancy headers missing.","solutions":["Inspect the wrapped gRPC status to classify the failure","Retry with backoff for codes.Unavailable/DeadlineExceeded","Verify remote storage server health and endpoint config","Ensure the context deadline is adequate for trace-fetch workloads"],"exampleFix":"// before\nfor traces, err := range reader.GetTraces(ctx, ids, q) { ... }\n// after\nctx, cancel := context.WithTimeout(ctx, 30*time.Second)\ndefer cancel()\nfor traces, err := range reader.GetTraces(ctx, ids, q) {\n    if err != nil && status.Code(err) == codes.Unavailable { /* retry */ }\n}","handlingStrategy":"retry","validationCode":"// validate trace IDs before querying\nfor _, id := range traceIDs {\n    if _, err := pcommon.TraceIDFromHex(id); err != nil {\n        return fmt.Errorf(\"invalid trace ID %q\", id)\n    }\n}","typeGuard":null,"tryCatchPattern":"for traces, err := range reader.GetTraces(ctx, ids, q) {\n    if err != nil {\n        if status.Code(err) == codes.Unavailable || status.Code(err) == codes.DeadlineExceeded {\n            // retry with backoff\n        }\n        return err\n    }\n}","preventionTips":["Set adequate context timeouts for trace fetches","Health-check remote storage before query bursts","Keep trace ID inputs validated and canonical hex"],"tags":["grpc","network","traces"],"backgroundTag":"grpc-stream-error","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}