#4318·redis-py

RedisCluster and async RedisCluster disagree on an empty target_nodes

Author: dylanpulverCreated Sep 10, 2026Updated Sep 10, 2026

redis/cluster.py guards on is not None:

python
if passed_targets is not None and not self._is_nodes_flag(passed_targets):

redis/asyncio/cluster.py guards on truthiness:

python
if passed_targets and not self._is_node_flag(passed_targets):

_is_nodes_flag / _is_node_flag and _parse_target_nodes are identical in both, so the only difference is which values reach them.

With target_nodes=[] the sync client sets target_nodes_specified = True, skips _determine_nodes, and runs the command on no nodes. The async client sees [] as falsy, leaves target_nodes_specified False, and routes by the default request policy, so the command runs. That flag also drives retry_attempts = 0 if target_nodes_specified, so retry behaviour differs as well.

target_nodes="" splits the same way: sync reaches _parse_target_nodes and raises a TypeError naming the accepted types, async ignores the argument and routes by policy.

I found this by diffing the two implementations rather than by running a cluster, so I have not measured which side you consider correct. Happy to send a PR once you say which way it should go.

Generated with Claude Code

https://claude.ai/code/session_011M5uTyCU4WcNTsPvGrErDo