{"record":{"id":"59d675646173ec02","repo":"sgl-project/sglang","slug":"invalid-quantization-method-quantization","errorCode":null,"errorMessage":"Invalid quantization method: {quantization}","messagePattern":"Invalid quantization method: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/layers/quantization/__init__.py","lineNumber":94,"sourceCode":"    def _wrapper(quant_config_cls):\n        if quantization in QUANTIZATION_METHODS:\n            raise ValueError(\n                f\"The quantization method `{quantization}` is already exists.\"\n            )\n        if not issubclass(quant_config_cls, QuantizationConfig):\n            raise ValueError(\n                \"The quantization config must be a subclass of \" \"`QuantizationConfig`.\"\n            )\n        _CUSTOMIZED_METHOD_TO_QUANT_CONFIG[quantization] = quant_config_cls\n        QUANTIZATION_METHODS.append(quantization)\n        return quant_config_cls\n\n    return _wrapper\n\n\ndef get_quantization_config(quantization: str) -> type[QuantizationConfig]:\n    if quantization not in QUANTIZATION_METHODS:\n        raise ValueError(f\"Invalid quantization method: {quantization}\")\n\n    method_to_config: dict[str, type[QuantizationConfig]] = {}\n    # Update the `method_to_config` with customized quantization methods.\n    method_to_config.update(_CUSTOMIZED_METHOD_TO_QUANT_CONFIG)\n\n    return method_to_config[quantization]\n\n\n__all__ = [\n    \"QuantizationMethods\",\n    \"QuantizationConfig\",\n    \"get_quantization_config\",\n    \"QUANTIZATION_METHODS\",\n]\n","sourceCodeStart":76,"sourceCodeEnd":109,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/quantization/__init__.py#L76-L109","documentation":"get_quantization_config looks up the requested quantization method in QUANTIZATION_METHODS and raises when the name is not registered. This is the standard entry point mapping a quantization string (e.g. from model config or CLI) to its QuantizationConfig class.","triggerScenarios":"Calling get_quantization_config(\"some_method\") where the string is not in QUANTIZATION_METHODS — typo'd names, unregistered custom methods, or methods only available in a newer/older version.","commonSituations":"Typo in a CLI --quantization flag or model config quantization_config.quant_method; using a quant method whose plugin isn't imported; version mismatch where the method was added or removed.","solutions":["Print/inspect QUANTIZATION_METHODS and correct the string to a registered name","If it's a custom method, ensure the module calling register_quantization is imported before lookup","Upgrade/downgrade to the version that supports the method you need"],"exampleFix":"// before\nconfig = get_quantization_config(\"fpx\")  # typo\n\n// after\nconfig = get_quantization_config(\"fp8\")","handlingStrategy":"validation","validationCode":"from ...quantization import QUANTIZATION_METHODS\nif quantization not in QUANTIZATION_METHODS:\n    raise SystemExit(f\"Unknown quant method {quantization!r}; valid: {QUANTIZATION_METHODS}\")","typeGuard":null,"tryCatchPattern":"try:\n    cfg = get_quantization_config(name)\nexcept ValueError as e:\n    # fall back to a default or exit with a clear message\n    ...","preventionTips":["Validate the quantization string against QUANTIZATION_METHODS at config parse time","Catch ValueError and surface valid options to the user"],"tags":["quantization","lookup","invalid-argument","config"],"backgroundTag":"unknown-quantization-method","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}