{"record":{"id":"e7b52fc24986e1b9","repo":"jaegertracing/jaeger","slug":"invalid-trace-id-w-e7b52f","errorCode":null,"errorMessage":"invalid trace_id: %w","messagePattern":"invalid trace_id: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_span_details.go","lineNumber":145,"sourceCode":"\t\treturn querysvc.GetTraceParams{}, nil, errors.New(\"trace_id is required\")\n\t}\n\n\tif len(input.SpanIDs) == 0 {\n\t\treturn querysvc.GetTraceParams{}, nil, errors.New(\"span_ids is required and must not be empty\")\n\t}\n\n\t// Validate span count against configured limit\n\tif len(input.SpanIDs) > h.maxSpanDetailsPerRequest {\n\t\treturn querysvc.GetTraceParams{}, nil, fmt.Errorf(\n\t\t\t\"span_ids exceeds maximum limit: requested %d, max allowed %d\",\n\t\t\tlen(input.SpanIDs),\n\t\t\th.maxSpanDetailsPerRequest,\n\t\t)\n\t}\n\n\ttraceID, err := parseTraceID(input.TraceID)\n\tif err != nil {\n\t\treturn querysvc.GetTraceParams{}, nil, fmt.Errorf(\"invalid trace_id: %w\", err)\n\t}\n\n\t// Validate every span_id up front so a malformed value fails fast instead of\n\t// triggering a backend query that can never match a real span ID. Collect the\n\t// canonical lowercase hex form so the lookup set agrees with the ID the trace\n\t// iterator emits regardless of the request's casing.\n\tcanonicalSpanIDs := make([]string, 0, len(input.SpanIDs))\n\tfor _, spanIDStr := range input.SpanIDs {\n\t\tspanID, err := parseSpanID(spanIDStr)\n\t\tif err != nil {\n\t\t\treturn querysvc.GetTraceParams{}, nil, fmt.Errorf(\"invalid span_id %q: %w\", spanIDStr, err)\n\t\t}\n\t\tcanonicalSpanIDs = append(canonicalSpanIDs, spanID.String())\n\t}\n\n\treturn querysvc.GetTraceParams{\n\t\tTraceIDs: []tracestore.GetTraceParams{\n\t\t\t{TraceID: traceID},","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/cmd/jaeger/internal/extension/jaegerquery/internal/mcptools/internal/handlers/get_span_details.go#L127-L163","documentation":"buildQuery parses input.TraceID with parseTraceID, which requires a 32-character hex string representing a 16-byte pcommon.TraceID. Any parse failure (wrong length or non-hex characters) is wrapped as \"invalid trace_id\" so the caller knows the identifier itself is malformed.","triggerScenarios":"Passing a 16-character (8-byte) legacy-style ID without padding, an ID containing '0x' prefix or dashes, a decimal-formatted ID, or an empty string, to the get_span_details tool.","commonSituations":"Mixing IDs from systems using 64-bit span/trace IDs (W3C 8-byte traces) with Jaeger's 128-bit format; copying IDs from logs with formatting applied; a client passing a span ID into the trace_id field.","solutions":["Provide the full 32-character lowercase hex trace ID, e.g. \"4bf92f3577b34da6a3ce929d0e0e4736\".","Left-pad 16-hex-char legacy IDs with zeros to 32 characters.","Strip any \"0x\" prefix, dashes, or whitespace before calling the tool.","Confirm you are not passing a span ID where trace_id is expected."],"exampleFix":"// before\nTraceID: \"4bf92f3577b34da6\" // 16 chars\n// after\nTraceID: \"00000000000000004bf92f3577b34da6\" // padded to 32 hex chars","handlingStrategy":"validation","validationCode":"func validTraceID(s string) bool {\n\tif len(s) != 32 { return false }\n\t_, err := hex.DecodeString(s)\n\treturn err == nil\n}","typeGuard":"func normalizeTraceID(s string) (string, bool) {\n\ts = strings.TrimPrefix(strings.TrimSpace(s), \"0x\")\n\tif len(s) < 16 || len(s) > 32 { return \"\", false }\n\tif _, err := hex.DecodeString(s); err != nil { return \"\", false }\n\treturn fmt.Sprintf(\"%032s\", s), true\n}","tryCatchPattern":"out, _, err := handler.Handle(ctx, req, input)\nif err != nil && strings.HasPrefix(err.Error(), \"invalid trace_id\") {\n\tid, ok := normalizeTraceID(input.TraceID)\n\tif !ok { return err }\n\tinput.TraceID = id\n\tout, _, err = handler.Handle(ctx, req, input)\n}","preventionTips":["Always pass 32-char lowercase hex trace IDs.","Left-pad 16-char legacy IDs with zeros to 32 chars.","Strip 0x prefixes, dashes, and whitespace at ingestion into your client.","Never reuse a span ID in the trace_id field."],"tags":["mcp","validation","trace-id","jaeger"],"backgroundTag":"invalid-trace-id-format","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}