{"record":{"id":"e716cf8a62de6e14","repo":"sgl-project/sglang","slug":"mm-preprocess-cache-size-mb-must-be-non-negative","errorCode":null,"errorMessage":"mm_preprocess_cache_size_mb must be non-negative","messagePattern":"mm_preprocess_cache_size_mb must be non-negative","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":4377,"sourceCode":"                    \"--enable-http2 requires the 'granian' package. \"\n                    'Install it with: pip install \"sglang[http2]\"'\n                )\n\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)","sourceCodeStart":4359,"sourceCodeEnd":4395,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L4359-L4395","documentation":"The multimodal preprocessing cache size (--mm-preprocess-cache-size-mb) must be None (unset) or a non-negative number. SGLang validates this in _handle_multimodal before workers start, because a negative cache size is meaningless.","triggerScenarios":"Passing --mm-preprocess-cache-size-mb -1 or any negative value (or a negative SGLANG_* env override) at server launch.","commonSituations":"Attempting to disable the cache with -1 or 0 semantics borrowed from other tools; sign typos in tuning scripts; env var overrides with stray minus signs.","solutions":["Pass a non-negative value, e.g. --mm-preprocess-cache-size-mb 512","To effectively disable caching, set it to 0 (if supported) or omit the flag","Check env/launch scripts for accidental negative values"],"exampleFix":"# before\n--mm-preprocess-cache-size-mb -1\n# after\n--mm-preprocess-cache-size-mb 0","handlingStrategy":"validation","validationCode":"if args.mm_preprocess_cache_size_mb is not None:\n    assert args.mm_preprocess_cache_size_mb >= 0","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate env-derived numbers before launch","Use 0 rather than negative sentinels"],"tags":["multimodal","cache","server-args","validation"],"backgroundTag":"config-value-out-of-range","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}