{"record":{"id":"f38f3bf7b3c1e03a","repo":"jaegertracing/jaeger","slug":"trace-id-is-required-f38f3b","errorCode":null,"errorMessage":"trace_id is required","messagePattern":"trace_id is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_trace_errors.go","lineNumber":101,"sourceCode":"\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\n\ttraceID, err := parseTraceID(input.TraceID)\n\tif err != nil {\n\t\treturn querysvc.GetTraceParams{}, fmt.Errorf(\"invalid trace_id: %w\", err)\n\t}\n\n\treturn querysvc.GetTraceParams{\n\t\tTraceIDs: []tracestore.GetTraceParams{\n\t\t\t{TraceID: traceID},\n\t\t},\n\t\tRawTraces: false, // We want adjusted traces\n\t}, nil\n}\n","sourceCodeStart":83,"sourceCodeEnd":116,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_trace_errors.go#L83-L116","documentation":"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.","triggerScenarios":"Calling the get_trace_errors MCP tool with TraceID == \"\" — typically the argument was omitted or populated from an empty upstream variable.","commonSituations":"MCP schema not marking trace_id required; chained tool call where the previous step failed silently and passed \"\"; manual tool invocation missing the field.","solutions":["Pass a non-empty trace_id to the tool","Validate the input in the client before invoking; enforce required fields in the tool schema","Fail fast in orchestration code when an upstream step yields an empty trace ID"],"exampleFix":"// before\nout, err := traceErrors.Handle(ctx, req, types.GetTraceErrorsInput{TraceID: stepOutput.TraceID})\n// after\nif stepOutput.TraceID == \"\" {\n    return errors.New(\"upstream step produced no trace ID; cannot analyze errors\")\n}\nout, err := traceErrors.Handle(ctx, req, types.GetTraceErrorsInput{TraceID: stepOutput.TraceID})","handlingStrategy":"validation","validationCode":"if input.TraceID == \"\" {\n    return errors.New(\"trace_id is required before calling get_trace_errors\")\n}","typeGuard":null,"tryCatchPattern":"out, err := handler.Handle(ctx, req, input)\nif err != nil && strings.Contains(err.Error(), \"trace_id is required\") {\n    return fmt.Errorf(\"get_trace_errors called without trace_id; check upstream step output\")\n}","preventionTips":["Enforce trace_id as a required tool argument in the schema","Guard chained calls: abort the chain when an upstream step yields an empty ID","Log tool inputs at the orchestration layer to catch empty-argument regressions"],"tags":["jaeger","mcp","validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}