Consumer group does not exist on the stream
Production Risk
Medium — consumers cannot process messages until the group is created; messages accumulate in the stream.
Raised by stream commands such as XREADGROUP, XACK, XPENDING, and XCLAIM when the specified consumer group name has not been created on the target stream. The group must be explicitly created with XGROUP CREATE before use.
- 1XGROUP CREATE was never called for this stream/group combination.
- 2The stream key was deleted (DEL or FLUSHDB), destroying all associated consumer groups.
- 3A typo in the group name passed to XREADGROUP or XACK.
- 4The group was created on a different stream key than the one being read.
A consumer tries to read from a group that has not been created yet.
# Stream exists but group was never created XADD mystream * field1 value1 XREADGROUP GROUP mygroup consumer1 COUNT 1 STREAMS mystream >
expected output
(error) NOGROUP No such consumer group 'mygroup' for key name 'mystream'
Fix 1
Create the consumer group before reading
WHEN First-time setup or after a stream key was deleted
# Create group starting from the beginning of the stream XGROUP CREATE mystream mygroup 0 # Or create starting from new messages only XGROUP CREATE mystream mygroup $ # Create the stream automatically if it does not exist XGROUP CREATE mystream mygroup $ MKSTREAM
Why this works
XGROUP CREATE registers the group on the stream; subsequent XREADGROUP calls will succeed.
Fix 2
Handle NOGROUP in application startup
WHEN Your application manages its own group lifecycle
# Pseudo-code: idempotent group creation
try:
redis.xgroup_create("mystream", "mygroup", id="quot;, mkstream=True)
except ResponseError as e:
if "BUSYGROUP" not in str(e):
raise # Only ignore 'group already exists'Why this works
Creating the group at startup and ignoring BUSYGROUP makes group initialisation idempotent.
✕ Rely on the group existing without explicit creation
Redis does not auto-create consumer groups; NOGROUP will be raised every time until XGROUP CREATE is called.
✕ Delete stream keys in production without recreating groups
Deleting the key destroys all consumer group state including pending entries.
Streams and consumer groups introduced; NOGROUP error added.
XAUTOCLAIM and improved PEL handling added; NOGROUP behaviour unchanged.
Redis Streams — consumer groups documentation
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev