{"record":{"id":"02ba940a1c22c3cc","repo":"BerriAI/litellm","slug":"redis-client-does-not-support-lua-script-registrat","errorCode":null,"errorMessage":"Redis client does not support Lua script registration","messagePattern":"Redis client does not support Lua script registration","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/caching/redis_cache.py","lineNumber":680,"sourceCode":"                namespaced_keys: Final = tuple(self.check_and_fix_namespace(key=key) for key in keys)\n                return await registered_script(keys=namespaced_keys, args=args, client=client)\n\n            return standalone_executor\n\n        if hasattr(_redis_client, \"script_load\"):\n            script_sha: Final = _redis_client.script_load(script)\n\n            async def cluster_executor(\n                keys: Sequence[str],\n                args: Sequence[str | bytes | int | float],\n                client: object = None,\n            ) -> object:\n                namespaced_keys: Final = tuple(self.check_and_fix_namespace(key=key) for key in keys)\n                return await _redis_client.evalsha(script_sha, len(namespaced_keys), *namespaced_keys, *args)\n\n            return cluster_executor\n\n        raise ValueError(\"Redis client does not support Lua script registration\")\n\n    @_redis_circuit_breaker_guard\n    async def async_set_cache(self, key, value, **kwargs):\n        from redis.asyncio import Redis\n\n        if key is None:\n            verbose_logger.debug(\n                \"LiteLLM Redis Caching: async set() skipped — key is None, value=%r\",\n                value,\n            )\n            return None\n\n        start_time: Final = time.time()\n        try:\n            _redis_client: Final[Redis] = self.init_async_client()\n        except Exception as e:\n            end_time = time.time()\n            _duration = end_time - start_time","sourceCodeStart":662,"sourceCodeEnd":698,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/caching/redis_cache.py#L662-L698","documentation":"RedisSemanticCache/redis script setup found the configured Redis client lacks script_load, so Lua scripts cannot be pre-registered for atomic execution; the executor-selection logic rejects the client instead of silently mis-executing scripts.","triggerScenarios":"Thrown at litellm/caching/redis_cache.py:680 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a redis client built with Lua scripting support (standard redis-py supports it).","Avoid features that require register_script, or switch to a Redis client/backend that supports EVALSHA."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}