{"record":{"id":"b771d3ed1eea6a58","repo":"sgl-project/sglang","slug":"batching-config-must-be-a-schema-version-1-r","errorCode":null,"errorMessage":"batching config must be a {'schema_version': 1, 'rules': [...]} object, a list of rules, or a mapping keyed by model|resolution","messagePattern":"batching config must be a (.+?) object, a list of rules, or a mapping keyed by model\\|resolution","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/managers/dynamic_batch_admission.py","lineNumber":302,"sourceCode":"        raise ValueError(\"batching config schema_version must be 1\")\n    if isinstance(payload, dict) and isinstance(payload.get(\"rules\"), list):\n        return payload[\"rules\"]\n    if isinstance(payload, list):\n        return payload\n    if isinstance(payload, dict):\n        entries: list[dict[str, Any]] = []\n        for key, value in payload.items():\n            if key == \"schema_version\" or not isinstance(value, dict):\n                continue\n            model, _sep, resolution = key.partition(\"|\")\n            entry = dict(value)\n            if model:\n                entry.setdefault(\"model\", model)\n            if resolution:\n                entry.setdefault(\"resolution\", resolution)\n            entries.append(entry)\n        return entries\n    raise ValueError(\n        \"batching config must be a {'schema_version': 1, 'rules': [...]} object, \"\n        \"a list of rules, or a mapping keyed by model|resolution\"\n    )\n\n\ndef _validate_rule_keys(data: dict[str, Any], *, source: str) -> None:\n    unknown = sorted(set(data) - _BATCHING_RULE_KEYS)\n    if not unknown:\n        return\n\n    hints = []\n    for key in unknown:\n        matches = get_close_matches(key, _BATCHING_RULE_KEYS, n=1)\n        if matches:\n            hints.append(f\"{key!r} (did you mean {matches[0]!r}?)\")\n        else:\n            hints.append(repr(key))\n    raise ValueError(","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/managers/dynamic_batch_admission.py#L284-L320","documentation":"_config_entries accepts only three payload shapes: an object with a 'rules' list, a top-level list of rule dicts, or a mapping keyed by model|resolution strings. Anything else (numbers, strings, objects without 'rules') raises this ValueError.","triggerScenarios":"Loading a JSON file whose root is a string/int, or a dict that is not key-able as model|resolution and has no 'rules' list (e.g. {\"batch\": {...}}).","commonSituations":"Wrong file passed to the config path (e.g. a server-args JSON); malformed YAML-to-JSON conversion; mapping keys containing '|' in an unexpected format so the parser takes a different branch and falls through.","solutions":["Restructure the file to {\"schema_version\": 1, \"rules\": [ ...rule dicts... ]}","Verify the file at the batching-config path is actually a batching config and valid JSON","For the mapping form, key entries by 'model', 'resolution', or 'model|resolution' strings"],"exampleFix":"// before\n{\"batching\": {\"qwen-image\": {\"max_batch_size\": 4}}}\n// after\n{\"schema_version\": 1, \"rules\": [{\"model\": \"qwen-image\", \"max_batch_size\": 4}]}","handlingStrategy":"type-guard","validationCode":"import json\np = json.load(open(path))\nok = isinstance(p, list) or (isinstance(p, dict) and isinstance(p.get(\"rules\"), list))\nif not ok:\n    raise SystemExit(\"config root must be a rules object or list\")","typeGuard":"def is_valid_batching_payload(p) -> bool:\n    return isinstance(p, list) or (\n        isinstance(p, dict) and isinstance(p.get(\"rules\"), list)\n    )","tryCatchPattern":null,"preventionTips":["Standardize all configs on {\"schema_version\": 1, \"rules\": [...]}"],"tags":["config","json","batching","format"],"backgroundTag":"invalid-config-format","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}