{"record":{"id":"6dc30ce29e2c0b2d","repo":"sgl-project/sglang","slug":"mm-process-config-must-be-a-dict-but-got-type-cf","errorCode":null,"errorMessage":"mm_process_config must be a dict, but got {type(cfg.mm_process_config)}","messagePattern":"mm_process_config must be a dict, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":4380,"sourceCode":"\n            if cfg.enable_ssl_refresh:\n                raise ValueError(\n                    \"--enable-ssl-refresh is not supported with --enable-http2. \"\n                    \"Granian does not support SSL certificate hot-reloading. \"\n                    \"Use Uvicorn (the default) or handle certificate rotation externally.\"\n                )\n\n    def _handle_multimodal(self):\n        \"\"\"Validate mm_process_config structure before model loading.\"\"\"\n        cfg = resolving_view(self)\n        if (\n            cfg.mm_preprocess_cache_size_mb is not None\n            and cfg.mm_preprocess_cache_size_mb < 0\n        ):\n            raise ValueError(\"mm_preprocess_cache_size_mb must be non-negative\")\n        if cfg.mm_process_config is not None:\n            if not isinstance(cfg.mm_process_config, dict):\n                raise TypeError(\n                    f\"mm_process_config must be a dict, \"\n                    f\"but got {type(cfg.mm_process_config)}\"\n                )\n            for key in (\"image\", \"video\", \"audio\"):\n                if key in cfg.mm_process_config and not isinstance(\n                    cfg.mm_process_config[key], dict\n                ):\n                    raise TypeError(\n                        f\"mm_process_config['{key}'] must be a dict, \"\n                        f\"but got {type(cfg.mm_process_config[key])}\"\n                    )\n\n    def _handle_media_url_security(self):\n        \"\"\"Normalize and publish the media URL policy before workers start.\"\"\"\n        cfg = resolving_view(self)\n        self._declare(\n            \"_handle_media_url_security\",\n            allowed_media_domains=configure_media_url_security(","sourceCodeStart":4362,"sourceCodeEnd":4398,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L4362-L4398","documentation":"--mm-process-config accepts per-modality preprocessing overrides and must deserialize into a Python dict. SGLang raises TypeError when the parsed value is not a dict (e.g. a list, string, or number), typically from malformed JSON.","triggerScenarios":"Passing --mm-process-config with JSON that parses to a non-object, e.g. '[1,2]' or '\"fast\"' or '64'.","commonSituations":"Hand-written JSON on the CLI missing braces; quoting issues in shell/env files causing truncation to a scalar; config templating emitting a bare value.","solutions":["Ensure the value is a JSON object: --mm-process-config '{\"image\": {...}}'","Validate the JSON with a linter or echo it before launching","If scripting, build the dict and serialize with json.dumps instead of string concatenation"],"exampleFix":"# before\n--mm-process-config '[\"image\"]'\n# after\n--mm-process-config '{\"image\": {\"max_num_frames\": 16}}'","handlingStrategy":"type-guard","validationCode":"import json\ncfg = json.loads(args.mm_process_config) if isinstance(args.mm_process_config, str) else args.mm_process_config\nassert isinstance(cfg, dict), 'mm_process_config must be a JSON object'","typeGuard":"def is_mm_process_config(v) -> bool:\n    import json\n    if isinstance(v, str):\n        try:\n            v = json.loads(v)\n        except json.JSONDecodeError:\n            return False\n    return isinstance(v, dict)","tryCatchPattern":null,"preventionTips":["Generate the JSON with json.dumps in scripts","Shell-quote the whole JSON blob with single quotes"],"tags":["multimodal","json","server-args","type-error"],"backgroundTag":"invalid-json-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}