sgl-project/sglang · error · ValueError

batching config schema_version must be 1

Error message

batching config schema_version must be 1

What it means

If the config payload is a dict with a schema_version field, that field must be 1 (or absent, which is treated as 1). _config_entries raises for any other version because no other schema is supported.

Source

Thrown at python/sglang/multimodal_gen/runtime/managers/dynamic_batch_admission.py:284

def load_batching_config(path: str | None) -> list[BatchingRule]:
    if path is None:
        return []

    with open(path, encoding="utf-8") as f:
        payload = json.load(f)

    source = os.path.abspath(path)
    entries = _config_entries(payload)
    rules = [BatchingRule.from_dict(entry, source=source) for entry in entries]
    if not rules:
        raise ValueError(f"batching config {source} does not contain any rules")
    return rules


def _config_entries(payload: Any) -> list[dict[str, Any]]:
    if isinstance(payload, dict) and payload.get("schema_version") not in (None, 1):
        raise ValueError("batching config schema_version must be 1")
    if isinstance(payload, dict) and isinstance(payload.get("rules"), list):
        return payload["rules"]
    if isinstance(payload, list):
        return payload
    if isinstance(payload, dict):
        entries: list[dict[str, Any]] = []
        for key, value in payload.items():
            if key == "schema_version" or not isinstance(value, dict):
                continue
            model, _sep, resolution = key.partition("|")
            entry = dict(value)
            if model:
                entry.setdefault("model", model)
            if resolution:
                entry.setdefault("resolution", resolution)
            entries.append(entry)
        return entries
    raise ValueError(

View on GitHub (pinned to 0132848349)

Solutions

  1. Set "schema_version": 1 (integer) or remove the key
  2. If the config genuinely uses a newer schema, regenerate it with the version of the library you run

Example fix

// before
{"schema_version": "1", "rules": [...]}
// after
{"schema_version": 1, "rules": [...]}
Defensive patterns

Strategy: validation

Validate before calling

v = payload.get("schema_version") if isinstance(payload, dict) else None
if v not in (None, 1):
    raise SystemExit(f"unsupported schema_version {v!r}; must be integer 1")

Prevention

When it happens

Trigger: A config file like {"schema_version": 2, "rules": [...]} or schema_version as a string "1" (not in (None, 1)).

Common situations: Config written for/forward-ported from a newer tool version; schema_version stored as a string by a config generator; hand-bumped version numbers.

Related errors


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