BerriAI/litellm · error · ValueError
Redis client does not support Lua script registration
Error message
Redis client does not support Lua script registration
What it means
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.
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.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at litellm/caching/redis_cache.py:680 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/02ba940a1c22c3cc.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/caching/redis_cache.py:680
namespaced_keys: Final = tuple(self.check_and_fix_namespace(key=key) for key in keys)
return await registered_script(keys=namespaced_keys, args=args, client=client)
return standalone_executor
if hasattr(_redis_client, "script_load"):
script_sha: Final = _redis_client.script_load(script)
async def cluster_executor(
keys: Sequence[str],
args: Sequence[str | bytes | int | float],
client: object = None,
) -> object:
namespaced_keys: Final = tuple(self.check_and_fix_namespace(key=key) for key in keys)
return await _redis_client.evalsha(script_sha, len(namespaced_keys), *namespaced_keys, *args)
return cluster_executor
raise ValueError("Redis client does not support Lua script registration")
@_redis_circuit_breaker_guard
async def async_set_cache(self, key, value, **kwargs):
from redis.asyncio import Redis
if key is None:
verbose_logger.debug(
"LiteLLM Redis Caching: async set() skipped — key is None, value=%r",
value,
)
return None
start_time: Final = time.time()
try:
_redis_client: Final[Redis] = self.init_async_client()
except Exception as e:
end_time = time.time()
_duration = end_time - start_timeView on GitHub (pinned to 77b7c6c40c)