{"record":{"id":"edf758b24d97c514","repo":"vllm-project/vllm","slug":"tenant-id-must-be-a-string-or-null-got-type-valu","errorCode":null,"errorMessage":"tenant_id must be a string or null, got {type(value).__name__}: {value!r}","messagePattern":"tenant_id must be a string or null, got (.+?): (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"vllm/distributed/kv_transfer/kv_connector/v1/mooncake/store/worker.py","lineNumber":184,"sourceCode":"            enable_offload=bool(config.get(\"enable_offload\", False)),\n            tenant_id=_normalize_tenant_id(config.get(\"tenant_id\", DEFAULT_TENANT_ID)),\n        )\n\n    @staticmethod\n    def load_from_config() -> \"MooncakeStoreConfig\":\n        config_path = os.getenv(\"MOONCAKE_CONFIG_PATH\")\n        if not config_path:\n            raise ValueError(\n                \"The environment variable 'MOONCAKE_CONFIG_PATH' is not set.\"\n            )\n        return MooncakeStoreConfig.from_file(config_path)\n\n\ndef _normalize_tenant_id(value: Any) -> str:\n    if value is None:\n        return DEFAULT_TENANT_ID\n    if not isinstance(value, str):\n        raise TypeError(\n            f\"tenant_id must be a string or null, got {type(value).__name__}: {value!r}\"\n        )\n    tenant_id = value.strip()\n    return tenant_id if tenant_id else DEFAULT_TENANT_ID\n\n\ndef _parse_size(value: Any) -> int:\n    \"\"\"Parse storage size strings with units: GB, MB, KB, B.\"\"\"\n    if isinstance(value, int):\n        return value\n    if not isinstance(value, str):\n        try:\n            return int(value)\n        except (TypeError, ValueError) as e:\n            raise TypeError(f\"Unsupported type for size: {type(value)}\") from e\n\n    cleaned = value.strip().lower()\n    if not cleaned:","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/distributed/kv_transfer/kv_connector/v1/mooncake/store/worker.py#L166-L202","documentation":"_normalize_tenant_id only accepts string or null for the config file's tenant_id field (whitespace-only strings fall back to the default tenant). Any other JSON type — number, boolean, list, object — raises TypeError with the offending type name, because the tenant id is forwarded verbatim to the mooncake store as an isolation key.","triggerScenarios":"\"tenant_id\": 123, true, or [\"a\"] in the mooncake config JSON.","commonSituations":"Numeric tenant ids from orchestration systems templated into the JSON without quoting; YAML->JSON conversion turning a quoted id into a bare number.","solutions":["Quote the tenant id: \"tenant_id\": \"tenant-123\"","Set it to null (or omit the key) to use the default tenant"],"exampleFix":"// before\n{ \"tenant_id\": 12345 }\n\n// after\n{ \"tenant_id\": \"12345\" }","handlingStrategy":"type-guard","validationCode":"tid = raw.get(\"tenant_id\")\nif tid is not None and not isinstance(tid, str):\n    raise TypeError(\"tenant_id must be a string or null\")","typeGuard":"def is_valid_tenant_id(v) -> bool:\n    return v is None or isinstance(v, str)","tryCatchPattern":null,"preventionTips":["Always quote tenant ids in generated JSON","Validate generated config JSON with a JSON Schema before deploy"],"tags":["mooncake","config","type-error"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}