{"record":{"id":"1110e72c6bada75d","repo":"sgl-project/sglang","slug":"unsupported-online-scheme-online-scheme","errorCode":null,"errorMessage":"Unsupported online_scheme: {online_scheme}","messagePattern":"Unsupported online_scheme: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/layers/quantization/quark/quark.py","lineNumber":314,"sourceCode":"        kv_cache_config: Optional[dict[str, Any]] = None,\n        pack_method: str = \"reorder\",\n        is_prequantized: bool = False,\n        online_scheme: Optional[str] = None,\n        dequantization_config: Optional[QuantizationConfig] = None,\n        excluded_fp8_config: Optional[Fp8Config] = None,\n    ):\n        super().__init__()\n        if kv_cache_group is None:\n            kv_cache_group = []\n\n        if online_scheme is not None:\n            assert not is_prequantized\n            if online_scheme == \"quark_mxfp4\":\n                quant_config = self._create_online_mxfp4_config(\n                    model_type=hf_config.model_type\n                )\n            else:\n                raise ValueError(f\"Unsupported online_scheme: {online_scheme}\")\n\n        if quant_config is None:\n            raise ValueError(\"Either quant_config or online_scheme must be provided\")\n\n        self.online_scheme = online_scheme\n        self.quant_config = quant_config\n        self.kv_cache_group = kv_cache_group\n        self.kv_cache_config = kv_cache_config\n        self.pack_method = pack_method\n        self.exclude_layers = cast(list[str], self.quant_config.get(\"exclude\", []))\n        # Both are consumed by _is_draft_layer(), which has to tell an appended\n        # MTP/NextN draft layer from a target-model one. \"No draft stack\" is\n        # spelled None as often as it is spelled absent -- ModelConfig defaults\n        # the same field to None -- so coerce rather than let range() raise.\n        self.num_hidden_layers = getattr(hf_config, \"num_hidden_layers\", None)\n        self.num_nextn_predict_layers = int(\n            getattr(hf_config, \"num_nextn_predict_layers\", 0) or 0\n        )","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/layers/quantization/quark/quark.py#L296-L332","documentation":"QuarkConfig.__init__ accepts an online_scheme that names the online requantization scheme to build when no explicit quant_config is given. Currently only \"quark_mxfp4\" is implemented; any other string (typos, future scheme names) hits the else branch and raises ValueError.","triggerScenarios":"Constructing QuarkConfig(online_scheme=...) (typically via from_config mapping config[\"requantization_method\"] to online_scheme) with a value other than \"quark_mxfp4\", e.g. \"quark_fp8\" or \"mxfp4\".","commonSituations":"A checkpoint's requantization_method field contains a scheme sglang doesn't implement; user passes a custom --quantization value that is forwarded as online_scheme; version skew between checkpoint producer and sglang release.","solutions":["Use online_scheme=\"quark_mxfp4\" (i.e. --quantization quark_mxfp4), the only supported scheme.","If the checkpoint asks for a different requantization method, serve it with its native quant config instead (pass quant_config, not online_scheme).","Upgrade sglang if a newer release implements the scheme named in the error."],"exampleFix":"# before\nQuarkConfig(hf_config=cfg, is_prequantized=False, dequantization_config=d, online_scheme=\"quark_fp8\")\n\n# after\nQuarkConfig(hf_config=cfg, is_prequantized=False, dequantization_config=d, online_scheme=\"quark_mxfp4\")","handlingStrategy":"validation","validationCode":"SUPPORTED_SCHEMES = {\"quark_mxfp4\"}\nif online_scheme not in SUPPORTED_SCHEMES:\n    raise ValueError(f\"online_scheme must be one of {SUPPORTED_SCHEMES}, got {online_scheme!r}\")\ncfg = QuarkConfig(hf_config=hf_config, is_prequantized=False, dequantization_config=d, online_scheme=online_scheme)","typeGuard":"def is_supported_online_scheme(scheme: str) -> bool:\n    return scheme == \"quark_mxfp4\"","tryCatchPattern":"try:\n    QuarkConfig(hf_config=hf_config, is_prequantized=False, dequantization_config=d, online_scheme=scheme)\nexcept ValueError as e:\n    if \"Unsupported online_scheme\" in str(e):\n        scheme = \"quark_mxfp4\"  # or abort with clear message\n    raise","preventionTips":["Validate scheme strings against the allowlist before constructing configs.","Pass online_scheme from CLI flags parsed with choices=(\"quark_mxfp4\",).","Reject unknown requantization_method fields in checkpoint configs early."],"tags":["quantization","quark","config-validation","online-requantization","python"],"backgroundTag":"invalid-configuration-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}