sgl-project/sglang · error · ValueError

--http2-max-concurrent-streams must be between 1 and 4294967

Error message

--http2-max-concurrent-streams must be between 1 and 4294967295.

What it means

When HTTP/2 is enabled via --enable-http2, SGLang validates that --http2-max-concurrent-streams falls in the valid HTTP/2 protocol range (1 to 2^32-1). Values of 0, negative numbers, or values >= 4294967296 are rejected.

Source

Thrown at python/sglang/srt/server_args.py:4350

        if cfg.ssl_certfile and not os.path.isfile(cfg.ssl_certfile):
            raise ValueError(
                f"SSL certificate file not found: '{cfg.ssl_certfile}'. "
                f"Please check the --ssl-certfile path."
            )
        if cfg.ssl_ca_certs and not os.path.isfile(cfg.ssl_ca_certs):
            raise ValueError(
                f"SSL CA certificates file not found: '{cfg.ssl_ca_certs}'. "
                f"Please check the --ssl-ca-certs path."
            )
        if cfg.enable_ssl_refresh and not (cfg.ssl_certfile and cfg.ssl_keyfile):
            raise ValueError(
                "--enable-ssl-refresh requires --ssl-certfile and --ssl-keyfile "
                "to be specified."
            )

        if cfg.enable_http2:
            if not 0 < cfg.http2_max_concurrent_streams < 2**32:
                raise ValueError(
                    "--http2-max-concurrent-streams must be between 1 and "
                    "4294967295."
                )

            try:
                import granian  # noqa: F401
            except ImportError:
                raise ValueError(
                    "--enable-http2 requires the 'granian' package. "
                    'Install it with: pip install "sglang[http2]"'
                )

            if cfg.enable_ssl_refresh:
                raise ValueError(
                    "--enable-ssl-refresh is not supported with --enable-http2. "
                    "Granian does not support SSL certificate hot-reloading. "
                    "Use Uvicorn (the default) or handle certificate rotation externally."
                )

View on GitHub (pinned to 0132848349)

Solutions

  1. Set the value to a sane positive number, e.g. --http2-max-concurrent-streams 256
  2. If unsure, omit the flag to use the default
  3. Double-check scripts/env files for a stale 0 or negative override

Example fix

# before
--enable-http2 --http2-max-concurrent-streams 0
# after
--enable-http2 --http2-max-concurrent-streams 256
Defensive patterns

Strategy: validation

Validate before calling

if args.enable_http2:
    assert 0 < args.http2_max_concurrent_streams < 2**32, 'streams out of range'

Prevention

When it happens

Trigger: Starting the server with --enable-http2 and --http2-max-concurrent-streams set to 0, a negative number, or >= 2**32. Validated in _handle_ssl_validation before startup.

Common situations: Tuning copied from another proxy/server with different limits; accidentally passing 0 meaning 'unlimited'; unit confusion (e.g. passing bytes-like large numbers).

Related errors


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