{"record":{"id":"f1e80c94cfb164b6","repo":"sgl-project/sglang","slug":"unknown-cache-dit-params-keys-sorted-unknown","errorCode":null,"errorMessage":"Unknown cache_dit_params keys: {sorted(unknown)}. Valid keys: {sorted(CACHE_DIT_REQUEST_PARAM_KEYS)}.","messagePattern":"Unknown cache_dit_params keys: (.+?)\\. Valid keys: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/cache/cache_dit_integration.py","lineNumber":231,"sourceCode":"        \"scm_compute_bins\",\n        \"scm_cache_bins\",\n        \"scm_policy\",\n    }\n)\nCACHE_DIT_REQUEST_PARAM_KEYS = (\n    CACHE_DIT_REQUEST_KNOB_KEYS | CACHE_DIT_REQUEST_SCM_KEYS | {\"secondary\"}\n)\n\n\ndef resolve_cache_dit_request_overrides(raw: dict | None) -> dict:\n    \"\"\"Validate cache_dit_params and return a copy; unknown keys fail the request.\"\"\"\n    if raw is None:\n        return {}\n    if not isinstance(raw, dict):\n        raise ValueError(f\"cache_dit_params must be a dict, got {type(raw).__name__}.\")\n    unknown = set(raw) - CACHE_DIT_REQUEST_PARAM_KEYS\n    if unknown:\n        raise ValueError(\n            f\"Unknown cache_dit_params keys: {sorted(unknown)}. \"\n            f\"Valid keys: {sorted(CACHE_DIT_REQUEST_PARAM_KEYS)}.\"\n        )\n    overrides = dict(raw)\n    secondary = overrides.get(\"secondary\")\n    if secondary is not None:\n        if not isinstance(secondary, dict):\n            raise ValueError(\n                \"cache_dit_params['secondary'] must be a dict, got \"\n                f\"{type(secondary).__name__}.\"\n            )\n        unknown = set(secondary) - CACHE_DIT_REQUEST_KNOB_KEYS\n        if unknown:\n            raise ValueError(\n                f\"Unknown cache_dit_params['secondary'] keys: {sorted(unknown)}. \"\n                f\"Valid keys: {sorted(CACHE_DIT_REQUEST_KNOB_KEYS)}.\"\n            )\n        overrides[\"secondary\"] = dict(secondary)","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/cache/cache_dit_integration.py#L213-L249","documentation":"resolve_cache_dit_request_overrides computes unknown = set(raw) - CACHE_DIT_REQUEST_PARAM_KEYS and rejects any top-level key not in that allowlist, listing both the offending keys and the valid set. This prevents silently ignored typos in per-request cache-dit tuning.","triggerScenarios":"Sending cache_dit_params containing a key not in CACHE_DIT_REQUEST_PARAM_KEYS, e.g. {\"num_step\": 4} (typo) or {\"secondary_cfg\": 1.0} (flattened instead of nested under 'secondary').","commonSituations":"Typos or renamed keys after a version upgrade; assuming server-level CacheDitConfig field names are accepted per-request; flattening the nested 'secondary' dict to top level.","solutions":["Use only the valid keys printed in the error message (CACHE_DIT_REQUEST_PARAM_KEYS).","Put secondary-knob overrides under the nested 'secondary' key, not at top level.","Re-check CACHE_DIT_REQUEST_PARAM_KEYS in your sglang version's cache_dit_integration.py after upgrading."],"exampleFix":"// before\nrequest(cache_dit_params={\"secondary_cfg\": 1.0})\n// after\nrequest(cache_dit_params={\"secondary\": {\"cfg\": 1.0}})","handlingStrategy":"validation","validationCode":"from sglang.multimodal_gen.runtime.cache.cache_dit_integration import CACHE_DIT_REQUEST_PARAM_KEYS\nbad = set((cache_dit_params or {})) - CACHE_DIT_REQUEST_PARAM_KEYS\nassert not bad, f\"unknown keys: {bad}\"\nclient.generate(prompt, cache_dit_params=cache_dit_params)","typeGuard":"def valid_top_level_keys(params: dict) -> bool:\n    return set(params) <= CACHE_DIT_REQUEST_PARAM_KEYS","tryCatchPattern":"try:\n    client.generate(prompt, cache_dit_params=params)\nexcept ValueError as e:\n    if \"Unknown cache_dit_params keys\" in str(e):\n        params = {k: v for k, v in params.items() if k in CACHE_DIT_REQUEST_PARAM_KEYS}\n        retry(client.generate, prompt, cache_dit_params=params)\n    raise","preventionTips":["Derive allowed keys from CACHE_DIT_REQUEST_PARAM_KEYS at client build time.","Re-validate param names after sglang upgrades.","Use the nested 'secondary' dict rather than flattening knob names."],"tags":["cache-dit","unknown-key","request-validation","config"],"backgroundTag":"unknown-config-key","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}