{"record":{"id":"05c91972e8910ba4","repo":"thanos-io/thanos","slug":"otlp-invalid-client-type-only-http-and-grpc","errorCode":null,"errorMessage":"otlp: invalid client type. Only 'http' and 'grpc' are accepted. ","messagePattern":"otlp: invalid client type\\. Only 'http' and 'grpc' are accepted\\. ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tracing/otlp/otlp.go","lineNumber":65,"sourceCode":"\tcase TracingClientHTTP:\n\t\toptions := traceHTTPOptions(config)\n\n\t\tclient := otlptracehttp.NewClient(options...)\n\t\texporter, err = otlptrace.New(ctx, client)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\tcase TracingClientGRPC:\n\t\toptions := traceGRPCOptions(config)\n\t\tclient := otlptracegrpc.NewClient(options...)\n\t\texporter, err = otlptrace.New(ctx, client)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\tdefault:\n\t\treturn nil, errors.New(\"otlp: invalid client type. Only 'http' and 'grpc' are accepted. \")\n\t}\n\n\tprocessor := tracesdk.NewBatchSpanProcessor(exporter)\n\tsampler, err := getSampler(config)\n\tif err != nil {\n\t\tlogger.Log(err)\n\t}\n\ttp := newTraceProvider(ctx, processor, logger, config.ServiceName, config.ResourceAttributes, sampler)\n\n\treturn tp, nil\n}\n\nfunc newTraceProvider(\n\tctx context.Context,\n\tprocessor tracesdk.SpanProcessor,\n\tlogger log.Logger,\n\tserviceName string,\n\tattrs map[string]string,","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/tracing/otlp/otlp.go#L47-L83","documentation":"In pkg/tracing/otlp NewTracerProvider, the switch over the configured OTLP client type only handles 'http' and 'grpc'; any other value reaches the default branch and returns this sentinel error. OTLP exporter construction never happens, so no spans can be exported.","triggerScenarios":"OTLP tracing config with client_type set to something other than 'http' or 'grpc' (e.g. 'http/protobuf', 'HTTP', 'grcp', or empty).","commonSituations":"Copying OpenTelemetry SDK config conventions (http/protobuf) into Thanos config, casing mistakes, or typos like 'grcp'.","solutions":["Set the OTLP client type to exactly 'http' or 'grpc' (lowercase, no slashes)","Use 'grpc' for port 4317 and 'http' for port 4318 to match your collector","Fix typos and avoid casing variants","Consult the wrapped error/logs to confirm which value was parsed"],"exampleFix":"// before\nconfig:\n  client_type: HTTP/protobuf\n  endpoint: otel:4318\n// after\nconfig:\n  client_type: http\n  endpoint: otel:4318","handlingStrategy":"validation","validationCode":"// Before invoking the OTLP tracing path\nif ct, ok := cfg[\"client_type\"]; !ok {\n    return fmt.Errorf(\"otlp config missing client_type\")\n} else if ct != \"http\" && ct != \"grpc\" {\n    return fmt.Errorf(\"otlp client_type %q invalid: only 'http' and 'grpc' accepted\", ct)\n}","typeGuard":"func validOTLPClientType(v interface{}) bool {\n    s, ok := v.(string)\n    return ok && (s == \"http\" || s == \"grpc\")\n}","tryCatchPattern":"tracer, closer, err := tracing.NewTracer(ctx, logger, reg, cfgYaml)\nif err != nil && strings.Contains(err.Error(), \"invalid client type\") {\n    logger.Error(err, \"set otlp client_type to 'http' or 'grpc'\")\n    return err\n}","preventionTips":["Use lowercase 'http' or 'grpc' with no slashes or casing variants","Pick the type matching your collector port (4317=grpc, 4318=http)","Do not copy OpenTelemetry SDK exporter names (http/protobuf) into this field"],"tags":["tracing","otlp","opentelemetry","invalid-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}