sgl-project/sglang · error · ValueError

LoRA targets the DSA indexer ({sorted(indexer_targets)}), wh

Error message

LoRA targets the DSA indexer ({sorted(indexer_targets)}), which is incompatible with DSA indexer Q/K fusion. Set SGLANG_DISABLE_DSA_INDEXER_FUSION=1 to disable fusion and use indexer LoRA.

What it means

Raised in init_lora_shapes when an adapter targets the DSA (DeepSeek Sparse Attention) indexer modules while DSA indexer Q/K fusion is enabled. The fused indexer kernel does not expose separate Q/K projection points for LoRA insertion, so indexer-targeting LoRA is incompatible with the fusion path.

Source

Thrown at python/sglang/srt/lora/lora_manager.py:740

                        f"LoRA adapter '{lora_name}' contains target modules {sorted(unsupported_modules)} "
                        f"that are not included in the specified --lora-target-modules {sorted(self.target_modules)}. "
                        f"Please update --lora-target-modules to include all required modules: "
                        f"{sorted(self.target_modules | adapter_target_modules)}, or use 'all' to enable all supported modules."
                    )
            else:
                # Otherwise, infer target_modules from adapter configs.
                self.target_modules.update(adapter_target_modules)

        # Fusion folds wk + weights_proj into wk_weights_proj, so the modules
        # LoRA wraps are absent and an indexer-targeted adapter is silently dropped.
        indexer_targets = self.target_modules & DSA_INDEXER_LORA_NAMES
        if indexer_targets:
            from sglang.srt.layers.attention.dsa.dsa_indexer import (
                _use_dsa_indexer_fusion,
            )

            if _use_dsa_indexer_fusion:
                raise ValueError(
                    f"LoRA targets the DSA indexer ({sorted(indexer_targets)}), which is "
                    "incompatible with DSA indexer Q/K fusion. Set "
                    "SGLANG_DISABLE_DSA_INDEXER_FUSION=1 to disable fusion and use indexer LoRA."
                )

        if max_lora_rank is not None:
            self.max_lora_rank = max_lora_rank
        else:
            self.max_lora_rank = max(
                [x.r for x in self.configs.values()],
                default=0,
            )

        # Auto-infer self.lora_added_vocab_size from loaded LoRA configs
        # This happens automatically without requiring user input
        # if self.lora_added_vocab_size is None:
        if self.lora_added_tokens_size is None:
            inferred_extra_vocab_size = next(

View on GitHub (pinned to 0132848349)

Solutions

  1. Restart the server with SGLANG_DISABLE_DSA_INDEXER_FUSION=1
  2. Retrain the adapter without targeting the indexer modules

Example fix

# before
python -m sglang.launch_server --model ... --enable-lora
# after
SGLANG_DISABLE_DSA_INDEXER_FUSION=1 python -m sglang.launch_server --model ... --enable-lora
Defensive patterns

Strategy: validation

Validate before calling

import os, json
cfg = json.load(open(f'{path}/adapter_config.json'))
indexer_targets = {'indexer_wq', 'indexer_wk'} & set(cfg['target_modules'])
if indexer_targets and os.environ.get('SGLANG_DISABLE_DSA_INDEXER_FUSION') != '1':
    os.environ['SGLANG_DISABLE_DSA_INDEXER_FUSION'] = '1'  # before server start

Prevention

When it happens

Trigger: Loading a LoRA whose target modules include DSA indexer projections on a model with DSA, while the SGLANG_DISABLE_DSA_INDEXER_FUSION env var is unset so _use_dsa_indexer_fusion is True.

Common situations: Fine-tuning DSA indexer projections with PEFT and loading the adapter into a default SGLang server that fuses indexer Q/K by default; a runtime version where fusion became the default.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/8483c91a532bd209. Report an issue: GitHub.