Skip to content

fix: MOVED was not being redirected#513

Merged
laixintao merged 1 commit into
laixintao:masterfrom
rafaelclp:master
Mar 13, 2026
Merged

fix: MOVED was not being redirected#513
laixintao merged 1 commit into
laixintao:masterfrom
rafaelclp:master

Conversation

@rafaelclp
Copy link
Copy Markdown
Contributor

@rafaelclp rafaelclp commented Mar 12, 2026

Issue

When using iredis on a redis cluster, MOVED responses are not redirected.

After some debugging, I noticed iredis works when paired with redis==5, but not with redis==7.2:

image

Reason

Prior to redis-py 6, MOVED responses raised a ResponseError("MOVED <SLOT> <ADDR>"). When using redis.ClusterRedis, they raised MovedError("<SLOT> <ADDR>") instead.

MovedError is a subclass of ResponseError. The important part here is the error message. When raising MovedError, redis-py removes the MOVED string.

Starting from redis-py 6, the cluster parser exceptions were moved into the base parser, and so it started raising MovedError, without the MOVED string. This was changed in redis/redis-py#3475. You can also see the changelog for 6.0.0b1, which explicitely lists this as a breaking change:

Moved ClusterParser exceptions to BaseParser class (redis/redis-py#3475)

Fix

We keep supporting redis-py <6, but we handle MovedError separately from ResponseError.

@laixintao
Copy link
Copy Markdown
Owner

Thanks, this is a nice fix! merged.

@laixintao laixintao merged commit 591500c into laixintao:master Mar 13, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants