sgl-project/sglang · error · ValueError

{option} must use component=value entries

Error message

{option} must use component=value entries

What it means

Raised while parsing a comma-separated component=value map (e.g. --dit-layerwise-residency-policy or similar per-component options). Each comma-separated entry must contain an '=' separating the component name from its value; an entry without '=' cannot be interpreted. The parser is shared by the layerwise-tuning option family.

Source

Thrown at python/sglang/multimodal_gen/runtime/server_args/server_args.py:1053

        if isinstance(value, dict):
            return {str(k): str(v) for k, v in value.items()}
        if not isinstance(value, str):
            raise ValueError(
                f"{option} must be a dict or a comma-separated component=value string"
            )
        try:
            parsed = json.loads(value)
            if isinstance(parsed, dict):
                return {str(k): str(v) for k, v in parsed.items()}
        except json.JSONDecodeError:
            pass
        result: dict[str, str] = {}
        for pair in value.split(","):
            pair = pair.strip()
            if not pair:
                continue
            if "=" not in pair:
                raise ValueError(f"{option} must use component=value entries")
            component, entry = pair.split("=", 1)
            result[component.strip()] = entry.strip()
        return result

    def layerwise_tuning_for(
        self, component_name: str | None, *, dit_group: bool
    ) -> tuple[float, float, str]:
        """Prefetch size, resident layers and residency policy for one component."""
        prefetch_map = self._parse_component_value_map(
            self.layerwise_prefetch_size, option="--layerwise-prefetch-size"
        )
        resident_map = self._parse_component_value_map(
            self.layerwise_resident_layers, option="--layerwise-resident-layers"
        )
        policy_map = self._parse_component_value_map(
            self.layerwise_residency_policy, option="--layerwise-residency-policy"
        )

View on GitHub (pinned to 0132848349)

Solutions

  1. Rewrite the value as component=value pairs, e.g. 'dit=layerwise_offload,vae=resident'
  2. Check for stray commas or missing '=' in each comma-separated entry
  3. If a JSON form is supported for this option, use JSON instead of pair syntax

Example fix

# before
--dit-layerwise-residency-policy layerwise_offload
# after
--dit-layerwise-residency-policy dit=layerwise_offload
Defensive patterns

Strategy: validation

Validate before calling

def parse_component_pairs(value: str, option: str) -> dict[str, str]:
    out = {}
    for pair in value.split(','):
        pair = pair.strip()
        if not pair:
            continue
        assert '=' in pair, f'{option}: entry {pair!r} missing "="'
        k, v = pair.split('=', 1)
        out[k.strip()] = v.strip()
    return out

Prevention

When it happens

Trigger: Passing a CLI value like "dit=layerwise_offload,vae" (second pair lacks '='), or a bare token like "resident" instead of "dit=resident".

Common situations: Typing a single global value instead of per-component pairs; forgetting the '=' for one entry in a multi-entry list; stray commas producing empty/garbage tokens after stripping.

Related errors


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