Skip to content

AttributeError: 'ClusterPipeline' object has no attribute 'nodes_manager' when using index.load() with Redis Cluster #365

@nkilleen-work

Description

@nkilleen-work

Description

When using redisvl with a Redis Cluster client, calling the index.load() method results in an AttributeError. The error originates from within the redis-py library, which redisvl calls during its batch writing process.

The traceback indicates that redisvl's storage layer uses a ClusterPipeline object for its awrite operation. An internal helper function in redis-py, get_protocol_version, is then called, which attempts to access client.nodes_manager. However, the ClusterPipeline object does not have this attribute, leading to the crash.

This issue occurs when redisvl is used as a dependency, for example, within langgraph-checkpoint-redis when it attempts to save a checkpoint to a Redis Cluster.

Library Versions

  • redisvl: 0.8.0
  • redis: 6.4.0 (also observed with other 5.x versions including 5.3.1)
  • langgraph-checkpoint-redis: 0.1.1
  • python: 3.12

Traceback

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/redisvl/index/index.py", line 1566, in load
    return await self._storage.awrite(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/redisvl/index/storage.py", line 477, in awrite
    await self._aset(pipe, key, obj)
  File "/usr/local/lib/python3.12/site-packages/redisvl/index/storage.py", line 679, in _aset
    client.json().set(key, "$", obj)  # type: ignore[return-value, misc]
    ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/redis/commands/redismodules.py", line 24, in json
    jj = JSON(client=self, encoder=encoder, decoder=decoder)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/redis/commands/json/__init__.py", line 71, in __init__
    if get_protocol_version(self.client) in ["3", 3]:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/redis/commands/helpers.py", line 118, in get_protocol_version
    return client.nodes_manager.connection_kwargs.get("protocol")
           ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ClusterPipeline' object has no attribute 'nodes_manager'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 1123, in _checkpointer_put_after_previous
    await prev
  File "/usr/local/lib/python3.12/site-packages/langgraph/pregel/loop.py", line 1125, in _checkpointer_put_after_previous
    await cast(BaseCheckpointSaver, self.checkpointer).aput(
  File "/usr/local/lib/python3.12/site-packages/langgraph/checkpoint/redis/aio.py", line 1079, in aput
    raise e
  File "/usr/local/lib/python3.12/site-packages/langgraph/checkpoint/redis/aio.py", line 998, in aput
    await self.checkpoints_index.load(
  File "/usr/local/lib/python3.12/site-packages/redisvl/index/index.py", line 1583, in load
    raise RedisVLError(f"Failed to load data: {str(e)}") from e
redisvl.exceptions.RedisVLError: Failed to load data: 'ClusterPipeline' object has no attribute 'nodes_manager'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions