sgl-project/sglang · error · ValueError

Unsupported OTLP protocol '{protocol}' configured. Supported

Error message

Unsupported OTLP protocol '{protocol}' configured. Supported protocols are: {', '.join(sorted(supported_protocols))}

What it means

SGLang's tracing initialization reads the OTEL_EXPORTER_OTLP_TRACES_PROTOCOL environment variable to decide which OTLP span exporter to build. Only 'grpc' and 'http/protobuf' are recognized; any other value raises this ValueError. The check happens in get_otlp_span_exporter(), called from process_tracing_init when --enable-tracing or OTEL export is configured.

Source

Thrown at python/sglang/srt/observability/trace.py:275

    tracer = trace.get_tracer("sglang server")

    # Auto-start async trace exporter when SGLANG_TRACE_ASYNC=1
    if envs.SGLANG_TRACE_ASYNC.get():
        from sglang.srt.observability.trace_async import start_trace_exporter

        start_trace_exporter(otlp_endpoint, server_name, trace_modules=trace_modules)


def get_global_tracing_enabled():
    return opentelemetry_initialized


def get_otlp_span_exporter(endpoint):
    protocol = os.environ.get(OTEL_EXPORTER_OTLP_TRACES_PROTOCOL, "grpc")
    supported_protocols = {"grpc", "http/protobuf"}

    if protocol not in supported_protocols:
        raise ValueError(
            f"Unsupported OTLP protocol '{protocol}' configured. "
            f"Supported protocols are: {', '.join(sorted(supported_protocols))}"
        )

    if protocol == "grpc":
        return GRPCSpanExporter(endpoint=endpoint, insecure=True)
    elif protocol == "http/protobuf":
        return HTTPSpanExporter(endpoint=endpoint)


# Should be called by each tracked thread.
def trace_set_thread_info(
    thread_label: str,
    tp_rank: Optional[int] = None,
    dp_rank: Optional[int] = None,
    pp_rank: Optional[int] = None,
):
    if not opentelemetry_initialized:

View on GitHub (pinned to 0132848349)

Solutions

  1. Set OTEL_EXPORTER_OTLP_TRACES_PROTOCOL to exactly 'grpc' or 'http/protobuf'
  2. Unset the variable entirely — 'grpc' is the default
  3. Check for trailing whitespace/case differences in the env value (matching is exact)

Example fix

# before
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http
# after
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
Defensive patterns

Strategy: validation

Validate before calling

import os
proto = os.environ.get("OTEL_EXPORTER_OTLP_TRACES_PROTOCOL", "grpc")
assert proto in {"grpc", "http/protobuf"}, f"bad protocol: {proto!r}"

Prevention

When it happens

Trigger: Setting OTEL_EXPORTER_OTLP_TRACES_PROTOCOL to a value like 'http' (instead of 'http/protobuf'), 'http/json', or a typo'd string, then starting the server with tracing enabled (SGLANG_ENABLE_TRACING or --enable-tracing with an OTLP endpoint).

Common situations: OpenTelemetry conventions allow 'http/json' for some exporters; users copy configs from other OTel-instrumented apps and pass unsupported protocol names, or omit the '/protobuf' suffix.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/42c49a944b07889d. Report an issue: GitHub.