{"record":{"id":"08f2933244a3a812","repo":"sgl-project/sglang","slug":"batching-config-source-does-not-contain-any-rule","errorCode":null,"errorMessage":"batching config {source} does not contain any rules","messagePattern":"batching config (.+?) does not contain any rules","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/managers/dynamic_batch_admission.py","lineNumber":278,"sourceCode":"    def _get_device_memory_gb(gpu_id: int) -> float | None:\n        try:\n            return current_platform.get_device_total_memory(gpu_id) / BYTES_PER_GB\n        except Exception:\n            return None\n\n\ndef load_batching_config(path: str | None) -> list[BatchingRule]:\n    if path is None:\n        return []\n\n    with open(path, encoding=\"utf-8\") as f:\n        payload = json.load(f)\n\n    source = os.path.abspath(path)\n    entries = _config_entries(payload)\n    rules = [BatchingRule.from_dict(entry, source=source) for entry in entries]\n    if not rules:\n        raise ValueError(f\"batching config {source} does not contain any rules\")\n    return rules\n\n\ndef _config_entries(payload: Any) -> list[dict[str, Any]]:\n    if isinstance(payload, dict) and payload.get(\"schema_version\") not in (None, 1):\n        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:","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/managers/dynamic_batch_admission.py#L260-L296","documentation":"load_batching_config parses the JSON file into rule entries and requires at least one rule; an empty rules list (or an empty mapping form) produces this ValueError during DynamicBatchAdmission __init__.","triggerScenarios":"Pointing the batching config path at a JSON file whose top-level is {\"rules\": []}, [], or a mapping with no entries.","commonSituations":"Placeholder config created empty pending tuning; filtering script emitted zero rules; wrong file path resolves to an intentionally-empty shared config.","solutions":["Add at least one valid rule to the config file","If batching config is not wanted, unset the config path / CLI flag so the manager uses defaults instead of an empty file"],"exampleFix":"// before\n{\"schema_version\": 1, \"rules\": []}\n// after\n{\"schema_version\": 1, \"rules\": [{\"model_contains\": \"\", \"max_batch_size\": 8}]}","handlingStrategy":"validation","validationCode":"import json\npayload = json.load(open(path))\nentries = payload.get(\"rules\") if isinstance(payload, dict) else payload\nif not entries:\n    raise SystemExit(\"batching config has no rules; delete the file or add rules\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't point the batching-config flag at an empty placeholder file"],"tags":["config","batching","empty-config","startup"],"backgroundTag":"empty-config-file","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}