jaegertracing/jaeger · error

trace_id is required

Error message

trace_id is required

What it means

The buildQuery helper of get_trace_errors validates that a trace ID was provided before constructing querysvc.GetTraceParams. An empty TraceID cannot be parsed, so the handler short-circuits with this sentinel error rather than issuing an unscoped query.

Source

Thrown at cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_trace_errors.go:101

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

	output := types.GetTraceErrorsOutput{
		TraceID:         input.TraceID,
		TotalErrorCount: totalErrors,
		Spans:           errorSpans,
	}

	return nil, output, nil
}

// buildQuery converts GetTraceErrorsInput to querysvc.GetTraceParams.
func (*getTraceErrorsHandler) buildQuery(input types.GetTraceErrorsInput) (querysvc.GetTraceParams, error) {
	// Validate input
	if input.TraceID == "" {
		return querysvc.GetTraceParams{}, errors.New("trace_id is required")
	}

	traceID, err := parseTraceID(input.TraceID)
	if err != nil {
		return querysvc.GetTraceParams{}, fmt.Errorf("invalid trace_id: %w", err)
	}

	return querysvc.GetTraceParams{
		TraceIDs: []tracestore.GetTraceParams{
			{TraceID: traceID},
		},
		RawTraces: false, // We want adjusted traces
	}, nil
}

View on GitHub (pinned to 806f444784)

Solutions

  1. Pass a non-empty trace_id to the tool
  2. Validate the input in the client before invoking; enforce required fields in the tool schema
  3. Fail fast in orchestration code when an upstream step yields an empty trace ID

Example fix

// before
out, err := traceErrors.Handle(ctx, req, types.GetTraceErrorsInput{TraceID: stepOutput.TraceID})
// after
if stepOutput.TraceID == "" {
    return errors.New("upstream step produced no trace ID; cannot analyze errors")
}
out, err := traceErrors.Handle(ctx, req, types.GetTraceErrorsInput{TraceID: stepOutput.TraceID})
Defensive patterns

Strategy: validation

Validate before calling

if input.TraceID == "" {
    return errors.New("trace_id is required before calling get_trace_errors")
}

Try / catch

out, err := handler.Handle(ctx, req, input)
if err != nil && strings.Contains(err.Error(), "trace_id is required") {
    return fmt.Errorf("get_trace_errors called without trace_id; check upstream step output")
}

Prevention

When it happens

Trigger: Calling the get_trace_errors MCP tool with TraceID == "" — typically the argument was omitted or populated from an empty upstream variable.

Common situations: MCP schema not marking trace_id required; chained tool call where the previous step failed silently and passed ""; manual tool invocation missing the field.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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