sgl-project/sglang · error · RuntimeError
Multiple distributions register serve backend {name!r}: {pro
Error message
Multiple distributions register serve backend {name!r}: {providers}. Uninstall one provider or choose another backend name. What it means
Raised when more than one installed distribution registers a serve backend under the same name in the 'sglang.serve_backends' entry-point group. SGLang cannot disambiguate which implementation to load, so it refuses with a RuntimeError naming the conflicting provider distributions.
Source
Thrown at python/sglang/cli/serve_backends.py:137
def get(self, name: str) -> RegisteredServeBackend:
"""Return one backend, importing only the explicitly requested plugin."""
if name in self._loaded:
return self._loaded[name]
candidates = self._entry_points.get(name, [])
if not candidates:
available = ", ".join(("auto", *self.available_names))
raise ValueError(
f"Unknown serve backend {name!r}. Available values: {available}."
)
if len(candidates) > 1:
providers = ", ".join(
sorted(
self._entry_point_provider(candidate) for candidate in candidates
)
)
raise RuntimeError(
f"Multiple distributions register serve backend {name!r}: "
f"{providers}. Uninstall one provider or choose another backend name."
)
entry_point = candidates[0]
try:
factory = entry_point.load()
if not callable(factory):
raise TypeError("the entry point must resolve to a callable factory")
backend = factory()
except Exception as exc:
raise RuntimeError(
f"Failed to load serve backend {name!r} from "
f"{self._entry_point_provider(entry_point)}: {exc}"
) from exc
if not isinstance(backend, ServeBackend):
raise TypeError(View on GitHub (pinned to 0132848349)
Solutions
- pip uninstall one of the conflicting distributions listed in the error message, then retry.
- Use a different backend name for the local fork (rename its entry point) so both can coexist.
- Verify with `importlib.metadata.entry_points(group='sglang.serve_backends')` that only one candidate remains per name.
Example fix
# before: both sglang-plugin-x and sglang-plugin-x-fork register backend "x" # after pip uninstall sglang-plugin-x-fork # or rename its entry point to "x-dev"
Defensive patterns
Strategy: validation
Validate before calling
from importlib.metadata import entry_points
eps = entry_points(group="sglang.serve_backends")
names = {}
for ep in eps:
names.setdefault(ep.name, []).append(ep)
amb = {n: ps for n, ps in names.items() if len(ps) > 1}
assert not amb, f"ambiguous backends: {amb}" Type guard
def is_unambiguous(name: str) -> bool:
return len(list(entry_points(group="sglang.serve_backends", name=name))) <= 1 Try / catch
try:
backend = registry.get(name)
except RuntimeError as e:
if "Multiple distributions" in str(e):
# print providers, ask user to uninstall one
... Prevention
- In CI, assert exactly one entry point per backend name after installing dependencies.
- Use a dedicated venv per backend-fork to avoid co-installing duplicate providers.
- Name forked backend entry points distinctly (e.g. x-dev) instead of shadowing.
When it happens
Trigger: Two distributions (e.g. an upstream plugin and a local fork, or a renamed package where both old and new are installed) each declare the same backend name in the sglang.serve_backends entry-point group; calling registry.get(name) for that name.
Common situations: Developing a fork of a backend plugin alongside the published one; pip install -e . of a local copy while the PyPI version is still installed; package renames leaving duplicate metadata behind.
Related errors
- Unknown serve backend {name!r}. Available values: {available
- Failed to load serve backend {name!r} from {self._entry_poin
- Serve backend {name!r} factory returned {type(backend).__nam
- Serve backend {name!r} uses API version {backend.api_version
- Multiple serve backends matched this request: {names}. Selec
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/0a10e99254a031e1.
Report an issue: GitHub.