{"record":{"id":"26e11f6e2a47b5af","repo":"sgl-project/sglang","slug":"unknown-dispatch-policy-name-available-list","errorCode":null,"errorMessage":"Unknown dispatch policy '{name}'. Available: {list(policies.keys())}","messagePattern":"Unknown dispatch policy '(.+?)'\\. Available: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/disaggregation/dispatch_policy.py","lineNumber":162,"sourceCode":"\n    def select_encoder_with_capacity(self, free_slots: list[int]) -> int | None:\n        return self.encoder_policy.select_with_capacity(free_slots)\n\n    def select_denoiser_with_capacity(self, free_slots: list[int]) -> int | None:\n        return self.denoiser_policy.select_with_capacity(free_slots)\n\n    def select_decoder_with_capacity(self, free_slots: list[int]) -> int | None:\n        return self.decoder_policy.select_with_capacity(free_slots)\n\n\ndef create_dispatch_policy(name: str, num_instances: int, **kwargs) -> DispatchPolicy:\n    policies = {\n        \"round_robin\": RoundRobin,\n        \"max_free_slots\": MaxFreeSlotsFirst,\n    }\n    cls = policies.get(name)\n    if cls is None:\n        raise ValueError(\n            f\"Unknown dispatch policy '{name}'. Available: {list(policies.keys())}\"\n        )\n    return cls(num_instances=num_instances, **kwargs)\n","sourceCodeStart":144,"sourceCodeEnd":166,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/disaggregation/dispatch_policy.py#L144-L166","documentation":"Raised by create_dispatch_policy when the requested policy name string is not one of the registered policies ('round_robin', 'max_free_slots'). The factory resolves the name against a dict of policy classes and falls through to this error for unknown keys.","triggerScenarios":"Calling create_dispatch_policy(name=..., num_instances=..., **kwargs) with a misspelled, differently-cased, or unimplemented policy name (e.g. 'roundrobin', 'least_loaded', 'RoundRobin').","commonSituations":"Typos or wrong naming convention in a YAML/JSON config, a config written for a newer/older sglang version with different policy names, or assuming a policy exists that was never implemented.","solutions":["Use exactly one of the registered names: 'round_robin' or 'max_free_slots' (lowercase with underscores)","Check the error message's Available list against your config value and fix casing/spelling","If you need a custom policy, subclass DispatchPolicy and construct it directly instead of via the factory","Pin config files to the sglang version whose policy names you verified"],"exampleFix":"# before\npolicy = create_dispatch_policy(name=\"roundrobin\", num_instances=4)\n\n# after\npolicy = create_dispatch_policy(name=\"round_robin\", num_instances=4)","handlingStrategy":"validation","validationCode":"ALLOWED = {\"round_robin\", \"max_free_slots\"}\nif policy_name not in ALLOWED:\n    raise ConfigError(f\"dispatch policy must be one of {ALLOWED}, got {policy_name!r}\")\npolicy = create_dispatch_policy(name=policy_name, num_instances=n, **kwargs)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate policy names against the factory's available list at config load time","Normalize config input (strip/lower) before passing to the factory","Add a config lint test that checks every policy name used in your YAML files"],"tags":["disaggregation","dispatch-policy","unknown-policy-name","factory"],"backgroundTag":"unknown-config-option","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}