#12207·Redis

[BUG] Should `SUBSCRIBE/UNSUBSCRIBE` be rejected in `MULTI`?

Author: rueianCreated May 21, 2023Updated Sep 16, 2026

Hi @MeirShpilraien, @oranagra,

I noticed that SUBSCRIBE inside MULTI is allowed for maintaining backward compatibility (https://github.com/redis/redis/pull/8025). However, it seems to produce responses that a client can't handle, for example, saying that a client issues the following commands:

MULTI
SUBSCRIBE c1 c2 c3
SET k v
GET k
EXEC

Then Redis will respond with:

+ OK
+ QUEUED
+ QUEUED
+ QUEUED
*
  > subscribe c1
  > subscribe c2
  > subscribe c3
+ OK                // leaked response for SET k v
$ v                 // leaked response for GET k

Is doing SUBSCRIBE/UNSUBSCRIBE inside MULTI really a valid use case?