{"record":{"id":"5a437260e007c6ab","repo":"sgl-project/sglang","slug":"the-quantization-method-quantization-is-alread","errorCode":null,"errorMessage":"The quantization method `{quantization}` is already exists.","messagePattern":"The quantization method `(.+?)` is already exists\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/layers/quantization/__init__.py","lineNumber":78,"sourceCode":"    \"kitchen_int8\": KitchenInt8Config,\n}\n\n\ndef register_quantization_config(quantization: str):\n    \"\"\"Register a customized vllm quantization config.\n\n    When a quantization method is not supported by vllm, you can register a customized\n    quantization config to support it.\n\n    Args:\n        quantization (str): The quantization method name.\n\n\n    \"\"\"  # noqa: E501\n\n    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]] = {}","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/quantization/__init__.py#L60-L96","documentation":"Raised by the register_quantization decorator's _wrapper when attempting to register a quantization method name that already exists in QUANTIZATION_METHODS. The library maintains a registry of quantization method names to prevent duplicate registrations that would silently override configs.","triggerScenarios":"Calling register_quantization with a name (e.g. \"my_quant\") that is already in QUANTIZATION_METHODS, e.g. registering a custom method whose name collides with a built-in like \"fp8\" or registering the same custom method twice.","commonSituations":"Re-running a notebook/cell that registers a custom quant method; copy-pasting a plugin module that gets imported twice; picking a custom method name that clashes with a built-in method.","solutions":["Choose a unique name for your custom quantization method and register it again","If re-registration is expected (e.g. module reload), guard with `if quantization not in QUANTIZATION_METHODS:` before registering","Check QUANTIZATION_METHODS to see the existing names before picking yours"],"exampleFix":"// before\n@register_quantization(\"fp8\")\nclass MyConfig(QuantizationConfig): ...\n\n// after\n@register_quantization(\"my_custom_fp8\")\nclass MyConfig(QuantizationConfig): ...","handlingStrategy":"validation","validationCode":"from ...quantization import QUANTIZATION_METHODS\nassert \"my_quant\" not in QUANTIZATION_METHODS, \"name already registered\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check QUANTIZATION_METHODS before registering","Use project-prefixed unique method names","Avoid re-importing registration modules (double registration)"],"tags":["quantization","registry","duplicate","config"],"backgroundTag":"duplicate-registry-entry","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}