{"record":{"id":"f3ab737b025386bd","repo":"jaegertracing/jaeger","slug":"failed-to-decode-span-id-w","errorCode":null,"errorMessage":"failed to decode span ID: %w","messagePattern":"failed to decode span ID: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v2/clickhouse/tracestore/dbmodel/from.go","lineNumber":109,"sourceCode":"\t}\n\tif len(b) != len(id) {\n\t\treturn id, fmt.Errorf(\"invalid length %d of decoded span ID %q, expected %d bytes\", len(b), s, len(id))\n\t}\n\tcopy(id[:], b)\n\treturn id, nil\n}\n\nfunc convertSpan(sr *SpanRow) (ptrace.Span, error) {\n\tspan := ptrace.NewSpan()\n\tspan.SetStartTimestamp(pcommon.NewTimestampFromTime(sr.StartTime))\n\ttraceId, err := decodeTraceID(sr.TraceID)\n\tif err != nil {\n\t\treturn span, fmt.Errorf(\"failed to decode trace ID: %w\", err)\n\t}\n\tspan.SetTraceID(traceId)\n\tspanId, err := decodeSpanID(sr.ID)\n\tif err != nil {\n\t\treturn span, fmt.Errorf(\"failed to decode span ID: %w\", err)\n\t}\n\tspan.SetSpanID(spanId)\n\tif sr.ParentSpanID != \"\" {\n\t\tparentSpanId, err := decodeSpanID(sr.ParentSpanID)\n\t\tif err != nil {\n\t\t\treturn span, fmt.Errorf(\"failed to decode parent span ID: %w\", err)\n\t\t}\n\t\tspan.SetParentSpanID(parentSpanId)\n\t}\n\tspan.TraceState().FromRaw(sr.TraceState)\n\tspan.SetName(sr.Name)\n\tspan.SetKind(jptrace.StringToSpanKind(sr.Kind))\n\tspan.SetEndTimestamp(pcommon.NewTimestampFromTime(sr.StartTime.Add(time.Duration(sr.Duration))))\n\tspan.Status().SetCode(jptrace.StringToStatusCode(sr.StatusCode))\n\tspan.Status().SetMessage(sr.StatusMessage)\n\n\tputAttributes(\n\t\tspan.Attributes(),","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v2/clickhouse/tracestore/dbmodel/from.go#L91-L127","documentation":"convertSpan wraps failures from decodeSpanID for the span's own ID with this message. The stored span ID is not valid hex or does not decode to exactly 8 bytes, so the pcommon.Span cannot be built.","triggerScenarios":"FromRow is called on a SpanRow whose ID column is empty, contains non-hex characters, or decodes to a length other than 8 bytes.","commonSituations":"External writers inserting rows without a span ID; encoding mismatches between producer and consumer versions; manual data fixes gone wrong.","solutions":["Check the ID column value in ClickHouse for the failing row","Ensure the ingestion path always writes a 16-hex-char span ID","Repair or remove malformed rows","Add a NOT NULL / format check at write time"],"exampleFix":"// before: empty ID silently stored then fails on read\n// after: validate at write time\nif spanID == \"\" { return errors.New(\"span ID is required\") }","handlingStrategy":"validation","validationCode":"if len(sr.ID) != 16 {\n    return fmt.Errorf(\"span ID %q must be 16 hex chars before conversion\", sr.ID)\n}","typeGuard":"func hasValidSpanID(sr *SpanRow) bool {\n    _, ok := isSpanID(sr.ID)\n    return ok\n}","tryCatchPattern":"span, err := FromRow(sr)\nif err != nil && strings.Contains(err.Error(), \"failed to decode span ID\") {\n    log.Warn(\"skipping row with malformed span ID\", \"id\", sr.ID)\n    continue\n}","preventionTips":["Make span ID NOT NULL and format-checked at the producer","Reject empty span IDs before INSERT","Run periodic data-quality scans on the spans table"],"tags":["clickhouse","span-id","error-wrapping","data-validation"],"backgroundTag":"invalid-span-id-length","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}