{"record":{"id":"3e9a4146d4465828","repo":"sgl-project/sglang","slug":"unknown-schedule-policy-policy","errorCode":null,"errorMessage":"Unknown schedule_policy: {policy=}","messagePattern":"Unknown schedule_policy: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/managers/schedule_policy.py","lineNumber":319,"sourceCode":"        )\n\n    def _validate_and_adjust_policy(\n        self, policy: str, tree_cache: BasePrefixCache\n    ) -> Policy:\n        \"\"\"\n        Validates the policy and adjusts it if necessary based on tree cache settings.\n        \"\"\"\n        try:\n            policy_enum = CacheAwarePolicy(policy)\n            if getattr(tree_cache, \"disable\", True):\n                # If tree_cache is disabled, using CacheAgnosticPolicy policy\n                return CacheAgnosticPolicy.FCFS\n            return policy_enum\n        except ValueError:\n            try:\n                return CacheAgnosticPolicy(policy)\n            except ValueError:\n                raise ValueError(f\"Unknown schedule_policy: {policy=}\")\n\n    def _compute_prefix_matches(\n        self, waiting_queue: List[Req], policy: CacheAwarePolicy\n    ) -> Set[int]:\n        \"\"\"\n        Computes and caches the matching prefixes for requests in the waiting queue,\n            and handles in-batch prefix caching logic.\n        \"\"\"\n        temporary_deprioritized: Set[int] = set()\n        self.waiting_queue_radix_tree.reset()\n\n        for r in waiting_queue:\n            prefix_ids = r.origin_input_ids + r.output_ids\n            extra_key = r.extra_key\n            cache_salt = r.cache_salt\n            match_result = match_prefix_for_req(\n                self.tree_cache, r, prefix_ids, include_req=True\n            )","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/managers/schedule_policy.py#L301-L337","documentation":"Raised in SchedulePolicy.__init__ via _validate_and_adjust_policy when the policy string is neither a valid CacheAwarePolicy nor CacheAgnosticPolicy enum value, meaning the scheduler cannot be constructed with it.","triggerScenarios":"Launching the server or constructing SchedulePolicy with an unknown schedule_policy string (e.g. 'fcfs ' with whitespace, 'LPM' wrong case where not aliased, or a made-up name).","commonSituations":"Typos or case mistakes in --schedule-policy, copy-pasting flags from other engines (vLLM policy names), or version changes that renamed policies.","solutions":["Use one of: fcfs, lpm, dfs-weight, lof, random, routing-key (exact, lowercase)","Print/inspect the accepted enum members from CacheAwarePolicy and CacheAgnosticPolicy for your installed version","Strip whitespace/quotes from the CLI value in launch scripts"],"exampleFix":"# before\n--schedule-policy longest-prefix-match\n# after\n--schedule-policy lpm","handlingStrategy":"try-catch","validationCode":"from sglang.srt.managers.schedule_policy import CacheAwarePolicy, CacheAgnosticPolicy\nok = policy in {p.value for p in CacheAwarePolicy} | {p.value for p in CacheAgnosticPolicy}","typeGuard":null,"tryCatchPattern":"try:\n    SchedulePolicy(policy, tree_cache, ...)\nexcept ValueError as e:\n    if 'Unknown schedule_policy' in str(e):\n        policy = 'fcfs'  # fallback\n    else:\n        raise","preventionTips":["Use literal policy strings copied from docs","Fail fast at config-parse time, not scheduler construction"],"tags":["startup","config","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}