{"record":{"id":"ba9daa91615f71ac","repo":"jaegertracing/jaeger","slug":"trace-not-found-ba9daa","errorCode":null,"errorMessage":"trace not found","messagePattern":"trace not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_trace_errors.go","lineNumber":85,"sourceCode":"\n\t\ttraceFound = true\n\n\t\t// Iterate through all spans in the trace\n\t\tfor pos, span := range jptrace.SpanIter(trace) {\n\t\t\t// Check if span has error status\n\t\t\tif span.Status().Code() == ptrace.StatusCodeError {\n\t\t\t\ttotalErrors++\n\t\t\t\t// Only build and collect detail up to the limit\n\t\t\t\tif h.maxSpanDetailsPerRequest == 0 || len(errorSpans) < h.maxSpanDetailsPerRequest {\n\t\t\t\t\tdetail := buildSpanDetail(pos, span)\n\t\t\t\t\terrorSpans = append(errorSpans, detail)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif !traceFound {\n\t\treturn nil, types.GetTraceErrorsOutput{}, errors.New(\"trace not found\")\n\t}\n\n\toutput := types.GetTraceErrorsOutput{\n\t\tTraceID:         input.TraceID,\n\t\tTotalErrorCount: totalErrors,\n\t\tSpans:           errorSpans,\n\t}\n\n\treturn nil, output, nil\n}\n\n// buildQuery converts GetTraceErrorsInput to querysvc.GetTraceParams.\nfunc (*getTraceErrorsHandler) buildQuery(input types.GetTraceErrorsInput) (querysvc.GetTraceParams, error) {\n\t// Validate input\n\tif input.TraceID == \"\" {\n\t\treturn querysvc.GetTraceParams{}, errors.New(\"trace_id is required\")\n\t}\n","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_trace_errors.go#L67-L103","documentation":"The get_trace_errors MCP handler fetches the trace by ID and scans its spans for error tags. This error is thrown when no trace matching the requested trace ID is found (traceFound stays false), so there is nothing to scan for errors.","triggerScenarios":"Calling get_trace_errors with a trace_id that does not exist in the storage backend; GetTraces yields no matching trace so the error is returned instead of an output with zero errors.","commonSituations":"Querying before the trace finished being ingested (write lag); retention expiry; sampling dropped the trace; wrong cluster/tenant; ID typo.","solutions":["Verify the trace exists with a direct trace lookup first","Retry after a short delay if the trace was just emitted (ingestion lag)","Confirm storage backend, retention window, and tenant/namespace match the writer","Re-check the trace ID for typos"],"exampleFix":"// before\nout, err := traceErrors.Handle(ctx, req, types.GetTraceErrorsInput{TraceID: id})\n// after\nout, err := traceErrors.Handle(ctx, req, types.GetTraceErrorsInput{TraceID: id})\nif err != nil && strings.Contains(err.Error(), \"trace not found\") {\n    time.Sleep(2 * time.Second) // allow ingestion lag\n    out, err = traceErrors.Handle(ctx, req, types.GetTraceErrorsInput{TraceID: id})\n}","handlingStrategy":"try-catch","validationCode":"func validateTraceErrorsInput(in types.GetTraceErrorsInput) error {\n    if in.TraceID == \"\" { return errors.New(\"trace_id required\") }\n    if _, err := hex.DecodeString(in.TraceID); err != nil { return fmt.Errorf(\"bad trace_id: %w\", err) }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"out, err := handler.Handle(ctx, req, input)\nif err != nil {\n    if strings.Contains(err.Error(), \"trace not found\") {\n        // retry once after a delay (ingestion lag), then surface as user-facing \"trace unavailable\"\n        time.Sleep(2 * time.Second)\n        out, err = handler.Handle(ctx, req, input)\n    }\n    if err != nil { return err }\n}","preventionTips":["Retry transient not-found shortly after trace emission to absorb ingestion lag","Check retention/sampling config for the query environment","Canonicalize trace IDs to lowercase hex before querying"],"tags":["jaeger","mcp","trace-not-found","storage"],"backgroundTag":"trace-not-found","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}