{"record":{"id":"8003cf40c5871bee","repo":"jaegertracing/jaeger","slug":"failed-to-compute-critical-path-w","errorCode":null,"errorMessage":"failed to compute critical path: %w","messagePattern":"failed to compute critical path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_critical_path.go","lineNumber":81,"sourceCode":"\n\tfor t, err := range aggregatedIter {\n\t\tif err != nil {\n\t\t\treturn nil, types.GetCriticalPathOutput{}, fmt.Errorf(\"failed to get trace: %w\", err)\n\t\t}\n\n\t\ttraceFound = true\n\t\ttrace = t\n\t\tbreak // We expect only one trace since we're querying by a single trace ID\n\t}\n\n\tif !traceFound {\n\t\treturn nil, types.GetCriticalPathOutput{}, errors.New(\"trace not found\")\n\t}\n\n\t// Compute critical path\n\tcriticalPathSections, err := criticalpath.ComputeCriticalPathFromTraces(trace)\n\tif err != nil {\n\t\treturn nil, types.GetCriticalPathOutput{}, fmt.Errorf(\"failed to compute critical path: %w\", err)\n\t}\n\n\t// Build output\n\toutput := h.buildOutput(input.TraceID, trace, criticalPathSections)\n\n\treturn nil, output, nil\n}\n\n// buildQuery converts GetCriticalPathInput to querysvc.GetTraceParams.\nfunc (*getCriticalPathHandler) buildQuery(input types.GetCriticalPathInput) (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\n\ttraceID, err := parseTraceID(input.TraceID)\n\tif err != nil {\n\t\treturn querysvc.GetTraceParams{}, fmt.Errorf(\"invalid trace_id: %w\", err)","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_critical_path.go#L63-L99","documentation":"After successfully fetching the trace, the handler calls criticalpath.ComputeCriticalPathFromTraces; if that computation fails it wraps the error as \"failed to compute critical path: <cause>\". It separates analysis failures from fetch failures so callers know the trace existed but the critical path algorithm could not process it.","triggerScenarios":"ComputeCriticalPathFromTraces returns an error on a retrieved trace — typically malformed or inconsistent span data (missing/unparseable timings, malformed references) retrieved by handle().","commonSituations":"Traces ingested by older/buggy instrumenters producing spans with invalid durations or parent references; corruption from a storage migration; traces with zero spans passing edge cases in the algorithm.","solutions":["Inspect the wrapped cause to see which span/timing was rejected.","Try a different, known-good trace ID to confirm the algorithm works and the issue is trace-specific data.","Check the ingestion path that produced the trace for instrumentation bugs (invalid timestamps/durations).","If reproducible on valid traces, report it with the trace ID and Jaeger version."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := handler.Handle(ctx, input)\nif err != nil && strings.Contains(err.Error(), \"failed to compute critical path:\") {\n    // trace fetched OK but analysis failed; fall back to returning the raw trace/span list\n    return fetchRawTrace(ctx, input.TraceID)\n}","preventionTips":["Validate trace integrity at ingestion (valid timestamps, durations, parent references).","Test critical-path computation against traces from each instrumented service.","Offer a raw-trace fallback path when analysis fails."],"tags":["critical-path","analysis","mcp"],"backgroundTag":"trace-analysis-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}