sgl-project/sglang · error · ComponentResidencyError

Component residency must use COMPONENT=MODE, got {assignment

Error message

Component residency must use COMPONENT=MODE, got {assignment!r}

What it means

Each comma-separated assignment in a residency string must contain '=' separating the component selector from the mode. A bare token like 'vit' has no mode and raises ComponentResidencyError.

Source

Thrown at python/sglang/multimodal_gen/runtime/managers/memory_managers/component_residency.py:73

    if assignments is None:
        return None

    if isinstance(assignments, Mapping):
        entries = assignments.items()
    else:
        values = [assignments] if isinstance(assignments, str) else assignments
        parsed_entries: list[tuple[str, str]] = []
        for value in values:
            if not isinstance(value, str):
                raise ComponentResidencyError(
                    f"Invalid component residency assignment: {value!r}"
                )
            for assignment in value.split(","):
                assignment = assignment.strip()
                if not assignment:
                    continue
                if "=" not in assignment:
                    raise ComponentResidencyError(
                        "Component residency must use COMPONENT=MODE, got "
                        f"{assignment!r}"
                    )
                selector, mode = assignment.split("=", 1)
                parsed_entries.append((selector, mode))
        entries = parsed_entries

    normalized: dict[str, str] = {}
    for raw_selector, raw_mode in entries:
        if not isinstance(raw_selector, str) or not isinstance(raw_mode, str):
            raise ComponentResidencyError(
                "Invalid component residency assignment: "
                f"{raw_selector!r}={raw_mode!r}"
            )
        selector = raw_selector.strip().replace("-", "_").lower()
        mode = raw_mode.strip().replace("_", "-").lower()
        if not selector:
            raise ComponentResidencyError(

View on GitHub (pinned to 0132848349)

Solutions

  1. Write the full COMPONENT=MODE form, e.g. vit=cpu
  2. Remove stray tokens lacking '='

Example fix

# before
--component-residency vit
# after
--component-residency vit=cpu
Defensive patterns

Strategy: validation

Validate before calling

for tok in s.split(","):
    tok = tok.strip()
    if tok and "=" not in tok:
        raise SystemExit(f"assignment {tok!r} lacks '=MODE'")

Prevention

When it happens

Trigger: A residency string such as "vit" or "vit,unet=cpu" — the first comma-separated token lacks '='.

Common situations: Passing just a component name intending a default mode; truncation from shell quoting; trailing stray tokens after a copy-paste.

Related errors


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