Skip to content

AttributeError: 'RedisCluster' object has no attribute 'connection_pool' #93

@bart-automation

Description

@bart-automation

Ran into this error when using the checkpointer with RedisCluster

package versions:
langgraph-checkpoint-redis==0.1.0
redis==6.4.0
redisvl==0.8.0

relevant code snippet:

with RedisSaver.from_conn_string('redis://localhost:7000?cluster=true') as checkpointer:
    checkpointer.setup()
    # run agent

Results in the following error when the connection is closed:

File "c:\projects\xxxxx\.venv\lib\site-packages\langgraph\checkpoint\redis_init_.py", line 1114, in from_conn_string
saver._redis.connection_pool.disconnect()
AttributeError: 'RedisCluster' object has no attribute 'connection_pool'

Code fragment that causes the error:

finally:
    if saver and saver._owns_its_client:  # Ensure saver is not None
        saver._redis.close()
        saver._redis.connection_pool.disconnect()

Adding this check fixes the issue:

if getattr(saver._redis, "connection_pool", None):
	saver._redis.connection_pool.disconnect()

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions