jaegertracing/jaeger · error

failed to get trace: %w

Error message

failed to get trace: %w

What it means

The get_critical_path MCP tool handler iterates the trace-store result for the requested trace ID; any iteration error from the query service/storage is wrapped as "failed to get trace: <cause>". This surfaces storage-level failures to the MCP caller instead of returning an empty result.

Source

Thrown at cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_critical_path.go:66

	input types.GetCriticalPathInput,
) (*mcp.CallToolResult, types.GetCriticalPathOutput, error) {
	// Build query parameters (includes validation)
	params, err := h.buildQuery(input)
	if err != nil {
		return nil, types.GetCriticalPathOutput{}, err
	}

	tracesIter := h.queryService.GetTraces(ctx, params)

	// Wrap with AggregateTraces to ensure each ptrace.Traces contains a complete trace
	aggregatedIter := jptrace.AggregateTraces(tracesIter)

	var trace ptrace.Traces
	traceFound := false

	for t, err := range aggregatedIter {
		if err != nil {
			return nil, types.GetCriticalPathOutput{}, fmt.Errorf("failed to get trace: %w", err)
		}

		traceFound = true
		trace = t
		break // We expect only one trace since we're querying by a single trace ID
	}

	if !traceFound {
		return nil, types.GetCriticalPathOutput{}, errors.New("trace not found")
	}

	// Compute critical path
	criticalPathSections, err := criticalpath.ComputeCriticalPathFromTraces(trace)
	if err != nil {
		return nil, types.GetCriticalPathOutput{}, fmt.Errorf("failed to compute critical path: %w", err)
	}

	// Build output

View on GitHub (pinned to 806f444784)

Solutions

  1. Inspect the wrapped cause and jaeger-query logs to identify the storage/RPC failure.
  2. Verify the storage backend is healthy and reachable from jaeger-query.
  3. Retry the tool call once backend health is restored.
  4. Confirm the query service dependency configuration (remote storage / GRPC endpoint) is correct.
Defensive patterns

Strategy: retry

Try / catch

out, err := handler.Handle(ctx, input)
if err != nil && strings.Contains(err.Error(), "failed to get trace:") {
    // wrapped storage/query-service cause; log and retry after backend health check
    if storageHealthy() {
        out, err = handler.Handle(ctx, input)
    }
}

Prevention

When it happens

Trigger: handle() calls the query service for a single trace ID and the returned iterator yields a non-nil error (storage backend failure, query service RPC error).

Common situations: Storage backend (Cassandra/ES/ClickHouse) down or timing out; query service dependency misconfigured; trace data unavailable due to retention or backend partial outage.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/b734eacb44f517cf. Report an issue: GitHub.