Repository navigation
Description
RedisConnectionFactory.sync_to_async_redis can't convert a sync client configured with TLS keywords, so the async methods of SemanticCache (and anything else that converts a caller's client) fail on their first command. The same client works on every sync path.
Reproduction
Measured on main with redis-py 8.1.0. No server is needed, because the failure happens when the async pool builds its first connection:
import redis
from redisvl.redis.connection import RedisConnectionFactory
client = redis.Redis(host="example.com", ssl=True, password="x")
async_client = RedisConnectionFactory.sync_to_async_redis(client)
async_client.connection_pool.make_connection()
# TypeError: AbstractConnection.__init__() got an unexpected keyword argument 'ssl_validate_ocsp_stapled'Through the public API, this is what a user sees from await cache.acheck(...) on a SemanticCache built with redis_client=Redis(ssl=True, ...).
A client built from a URL, Redis.from_url("rediss://..."), converts correctly and keeps TLS, so only keyword-configured TLS clients are affected.
Cause
sync_to_async_redis (redisvl/redis/connection.py) passes the sync pool's connection_kwargs through unchanged to AsyncConnectionPool. The sync SSLConnection carries keyword arguments that the async connection classes don't accept, so the first make_connection() raises.
The same pass-through breaks two other client shapes in the same way:
| Sync client | Error on first async command |
|---|---|
Redis(ssl=True, ...) |
TypeError: ... unexpected keyword argument 'ssl_validate_ocsp_stapled' |
Redis(unix_socket_path=...) |
TypeError: ... unexpected keyword argument 'path' |
Sentinel(...).master_for(...) |
TypeError: ... unexpected keyword argument 'connection_pool' |
The helper also picks the async TLS class with connection_class == SSLConnection, an exact-type check. A custom subclass of SSLConnection therefore gets a plaintext async connection, with the password still set.
Where it surfaces
BaseCache._get_async_redis_client(redisvl/extensions/cache/base.py) converts a provided client for all async cache methods.AsyncSearchIndex's wrong-client error message tells users to callsync_to_async_redis()themselves.- feat(router): add async aroute and aroute_many to SemanticRouter #784 adds async routing to
SemanticRouterthrough the same helper.
Suggested fix
Build the async connection from the sync pool's settings, not its raw kwargs: drop or translate the sync-only keys, map UnixDomainSocketConnection and SSLConnection (with issubclass) to their async equivalents, and raise a clear ValueError for Sentinel-managed pools, as the helper already does for RedisCluster.
Activity
fix(connection): convert TLS and unix-socket clients to async
fix(connection): convert TLS and unix-socket clients to async (redis#792
applied-ai-release-bot commentedon Nov 6, 2026
🚀 Issue was released in
v0.31.0🚀applied-ai-release-bot commentedon Nov 6, 2026
🚀 Issue was released in
v0.31.0🚀