{"record":{"id":"09df9b276affab11","repo":"jaegertracing/jaeger","slug":"trace-not-found-09df9b","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_span_details.go","lineNumber":102,"sourceCode":"\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\tspanIDStr := span.SpanID().String()\n\n\t\t\t// Check if this span ID is in the requested set\n\t\t\tif _, found := spanIDSet[spanIDStr]; found {\n\t\t\t\tdetail := buildSpanDetail(pos, span)\n\t\t\t\tspanDetails = append(spanDetails, detail)\n\n\t\t\t\t// Remove from set to track which spans we've found\n\t\t\t\tdelete(spanIDSet, spanIDStr)\n\t\t\t}\n\t\t}\n\t}\n\n\tif !traceFound {\n\t\treturn nil, types.GetSpanDetailsOutput{}, errors.New(\"trace not found\")\n\t}\n\n\toutput := types.GetSpanDetailsOutput{\n\t\tTraceID: input.TraceID,\n\t\tSpans:   spanDetails,\n\t}\n\n\t// Report any span IDs that were not found\n\tif len(spanIDSet) > 0 {\n\t\tmissingIDs := make([]string, 0, len(spanIDSet))\n\t\tfor spanID := range spanIDSet {\n\t\t\tmissingIDs = append(missingIDs, spanID)\n\t\t}\n\t\toutput.Error = fmt.Sprintf(\"spans not found: %v\", missingIDs)\n\t}\n\n\treturn nil, output, nil\n}","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_span_details.go#L84-L120","documentation":"The get_span_details MCP handler looks up a trace by ID and filters its spans by the requested span IDs. This error is thrown when GetTraces returns no trace matching the requested trace ID (traceFound remains false), so there are no spans to inspect.","triggerScenarios":"Calling get_span_details with a trace_id that does not exist in storage, or whose spans exist only in a different backend; the query returns zero iterations so traceFound never becomes true.","commonSituations":"Trace expired from retention; sampling prevented storage; wrong environment/tenant's trace ID; trace ID mistyped; replicas lagging behind the writer.","solutions":["Confirm the trace exists via a plain trace lookup before requesting span details","Check storage backend, tenant, and retention settings match where the trace was ingested","Re-check the trace ID for typos (all 32 hex chars)","Re-ingenerate/re-send the trace if sampling dropped it"],"exampleFix":"// before\nout, err := spanDetails.Handle(ctx, req, types.GetSpanDetailsInput{TraceID: id, SpanIDs: ids})\n// after\nif _, lookupErr := getTrace.Handle(ctx, req, types.GetTraceInput{TraceID: id}); lookupErr != nil {\n    return nil, fmt.Errorf(\"cannot fetch span details: trace %s unavailable: %w\", id, lookupErr)\n}\nout, err := spanDetails.Handle(ctx, req, types.GetSpanDetailsInput{TraceID: id, SpanIDs: ids})","handlingStrategy":"validation","validationCode":"func validateSpanDetailsInput(in types.GetSpanDetailsInput) 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    if len(in.SpanIDs) == 0 { return errors.New(\"span_ids required\") }\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        return fmt.Errorf(\"trace %s unavailable; check retention/sampling/backend\", input.TraceID)\n    }\n    return err\n}","preventionTips":["Confirm trace existence with a plain lookup before filtered span queries","Canonicalize span IDs to lowercase hex and drop zero values","Match the storage backend/tenant used at ingestion time"],"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"}