sgl-project/sglang · error · ValueError

Unknown event publisher '{kind}'

Error message

Unknown event publisher '{kind}'

What it means

KV event publishers self-register in a class registry keyed by the 'publisher' config string; create() looks up that key and raises ValueError for an unregistered kind.

Source

Thrown at python/sglang/srt/disaggregation/kv_events.py:658

    @classmethod
    def register_publisher(cls, name: str, ctor: Callable[..., EventPublisher]) -> None:
        if name in cls._registry:
            raise KeyError(f"publisher '{name}' already registered")
        cls._registry[name] = ctor

    @classmethod
    def create(cls, config: Optional[str], attn_dp_rank: int = 0) -> EventPublisher:
        """Create publisher from a config mapping."""
        if not config:
            return NullEventPublisher()
        config = KVEventsConfig.from_cli(config)
        config_dict = config.model_dump()

        kind = config_dict.pop("publisher", "null")
        try:
            constructor = cls._registry[kind]
        except KeyError as exc:
            raise ValueError(f"Unknown event publisher '{kind}'") from exc
        return constructor(attn_dp_rank=attn_dp_rank, **config_dict)

View on GitHub (pinned to 0132848349)

Solutions

  1. Check the spelling against supported publishers (e.g. 'null', 'kafka', 'radix', 'nixl')
  2. Install optional deps needed for the publisher (e.g. kafka-python)
  3. Verify the publisher class is imported/registered in your build

Example fix

// before
{"publisher": "kaffka", ...}
// after
{"publisher": "kafka", ...}
Defensive patterns

Strategy: validation

Validate before calling

from sglang.srt.disaggregation.kv_events import KVEventsPublisherFactory  # registry holder
kind = cfg.publisher
assert kind in KVEventsPublisherFactory._registry, f"unknown publisher {kind}; known={list(KVEventsPublisherFactory._registry)}"

Type guard

def is_known_publisher(kind: str) -> bool: return kind in KVEventsPublisherFactory._registry

Try / catch

catch ValueError from create() at startup; print registered kinds and exit with config error

Prevention

When it happens

Trigger: Passing KVEventsConfig(publisher="...") with a name that has no registered constructor — typo ('kaffka'), a publisher whose registration import failed, or a new name not in the build.

Common situations: Typos in --kv-events-config, using a publisher available only in a newer/older sglang version, or optional dependency (kafka) missing so the class never registered.

Related errors


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