{"record":{"id":"cc809185e08be4f3","repo":"sgl-project/sglang","slug":"f-cannot-parse-checkpoint-quantization-for-compon","errorCode":null,"errorMessage":"f\"Cannot parse checkpoint quantization for {component_name!r}: {error}\"","messagePattern":"f\"Cannot parse checkpoint quantization for (.+?): (.+?)\"","errorType":"exception","errorClass":"ComponentCheckpointUnsupportedError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/loader/component_loaders/component_loader.py","lineNumber":73,"sourceCode":")\n\nlogger = init_logger(__name__)\n\n\nclass ComponentCheckpointUnsupportedError(ValueError):\n    \"\"\"A component checkpoint is unsupported and must not use native fallback.\"\"\"\n\n\nclass NativeComponentLoaderRequired(RuntimeError):\n    \"\"\"The customized loader must defer to the native library loader.\"\"\"\n\n\ndef uses_native_transformers_bnb4(config: object, component_name: str) -> bool:\n    \"\"\"Validate a serialized BnB4 checkpoint owned by Transformers.\"\"\"\n    try:\n        quant_spec = resolve_checkpoint_quant_spec(config)\n    except (TypeError, ValueError) as error:\n        raise ComponentCheckpointUnsupportedError(\n            f\"Cannot parse checkpoint quantization for {component_name!r}: {error}\"\n        ) from error\n    if quant_spec is None or quant_spec.declared_method != \"bitsandbytes\":\n        return False\n    if quant_spec.source != \"quantization_config\":\n        raise ComponentCheckpointUnsupportedError(\n            f\"Transformers-managed {component_name!r} quantization requires \"\n            \"a top-level quantization_config; \"\n            f\"got metadata from {quant_spec.source!r}\"\n        )\n\n    load_in_4bit = quant_spec.config.get(\n        \"load_in_4bit\", quant_spec.config.get(\"_load_in_4bit\")\n    )\n    load_in_8bit = quant_spec.config.get(\n        \"load_in_8bit\", quant_spec.config.get(\"_load_in_8bit\", False)\n    )\n    if load_in_4bit is not True or load_in_8bit is True:","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/loader/component_loaders/component_loader.py#L55-L91","documentation":"uses_native_transformers_bnb4 inspects a component's serialized quantization metadata via resolve_checkpoint_quant_spec. If that parsing itself raises TypeError or ValueError (malformed quantization_config), it wraps it in ComponentCheckpointUnsupportedError with this message.","triggerScenarios":"A component config whose quantization_config is of an unexpected type (e.g. a list instead of dict) or contains invalid fields, causing resolve_checkpoint_quant_spec to raise; called during load_native or the bnb4 delegation path.","commonSituations":"Hand-edited or partially downloaded config.json with a broken quantization_config; checkpoints from tools that serialize quantization metadata in a non-standard shape; version drift in the quant spec schema.","solutions":["Inspect component config's quantization_config field and fix its structure (must be a parseable dict)","Re-download the component checkpoint in case config.json is truncated/corrupt","If the checkpoint genuinely uses an unsupported quant metadata layout, load it with an unquantized export instead"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"from sglang.srt.quantization import resolve_checkpoint_quant_spec\n\ntry:\n    resolve_checkpoint_quant_spec(config)\nexcept (TypeError, ValueError):\n    config.pop(\"quantization_config\", None)  # or repair the field","typeGuard":null,"tryCatchPattern":"except ComponentCheckpointUnsupportedError as e:\n    if \"Cannot parse checkpoint quantization\" in str(e):\n        logger.warning(\"malformed quant metadata on %s; using plain checkpoint\", name)","preventionTips":["Keep component config.json pristine from the original export","Run a config sanity linter on checkpoints before serving"],"tags":["quantization","bitsandbytes","config","model-loading"],"backgroundTag":"malformed-quantization-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}