{"record":{"id":"f91fad6be33cfab4","repo":"sgl-project/sglang","slug":"multiple-serve-backends-matched-this-request-nam","errorCode":null,"errorMessage":"Multiple serve backends matched this request: {names}. Select one explicitly with --model-type BACKEND.","messagePattern":"Multiple serve backends matched this request: (.+?)\\. Select one explicitly with --model-type BACKEND\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/cli/serve_backends.py","lineNumber":206,"sourceCode":"                if not isinstance(result, ServeBackendDetection):\n                    raise TypeError(\n                        \"detector must return ServeBackendDetection, got \"\n                        f\"{type(result).__name__}\"\n                    )\n                if result is ServeBackendDetection.MATCH:\n                    matches.append(registered)\n            except Exception as exc:\n                # An unrelated optional extension must not make the default LLM\n                # path unusable. Explicit selection remains strict via get().\n                logger.warning(\n                    \"Skipping automatic detection for serve backend %r: %s\",\n                    name,\n                    exc,\n                )\n\n        if len(matches) > 1:\n            names = \", \".join(match.name for match in matches)\n            raise RuntimeError(\n                f\"Multiple serve backends matched this request: {names}. \"\n                \"Select one explicitly with --model-type BACKEND.\"\n            )\n        if matches:\n            return matches[0]\n        return self.get(\"llm\")\n\n    @classmethod\n    def _entry_point_distribution(cls, entry_point: EntryPoint) -> str | None:\n        distribution = getattr(entry_point, \"dist\", None)\n        return getattr(distribution, \"name\", None)\n\n    @classmethod\n    def _entry_point_provider(cls, entry_point: EntryPoint) -> str:\n        return cls._entry_point_distribution(entry_point) or entry_point.value\n\n\n__all__ = [","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/cli/serve_backends.py#L188-L224","documentation":"Thrown by ServeBackendRegistry.auto_detect() when more than one registered backend's detector claims the request (e.g. the model path/config matches both a diffusion backend and another backend). Because detection cannot pick a winner, SGLang requires the user to disambiguate explicitly with --model-type.","triggerScenarios":"Running `sglang serve --model-path X` without --model-type where X matches multiple backends' detect() predicates; calling auto_detect(model_path=...) with an ambiguous path; two plugins implementing overly broad detectors.","commonSituations":"A model directory containing both LLM-style config.json and diffusion-model artifacts; a third-party detector that matches too aggressively alongside the built-in diffusion detector.","solutions":["Pass --model-type BACKEND with one of the names listed in the error.","If you own one of the detectors, narrow its detect() predicate so it only matches its intended models.","Uninstall the redundant backend package if it was accidental."],"exampleFix":"# before\nsglang serve --model-path ./my-model\n# after\nsglang serve --model-path ./my-model --model-type diffusion","handlingStrategy":"fallback","validationCode":"from sglang.cli.serve_backends import ServeBackendRegistry\nreg = ServeBackendRegistry()\n# detect ambiguity before it raises\n# (mirror auto_detect's match loop, or simply always pass --model-type)","typeGuard":null,"tryCatchPattern":"try:\n    backend = registry.auto_detect(model_path=p, ...)\nexcept RuntimeError as e:\n    if \"Multiple serve backends matched\" in str(e):\n        names = parse_names(e)\n        backend = registry.get(choose_interactively(names))","preventionTips":["Always pass --model-type explicitly in scripts/automation to bypass detection.","When writing plugins, keep detect() predicates narrow (exact config keys, not substrings)."],"tags":["sglang","cli","auto-detection","ambiguity","model-type"],"backgroundTag":"ambiguous-plugin-detection","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}