BUSYGROUP
RedisERRORCommonStreamsHIGH confidence

Consumer group with that name already exists on the stream

Production Risk

Very Low — the group already exists; no data is lost or corrupted.

What this means

Raised by XGROUP CREATE when a consumer group with the specified name already exists on the stream. This is typically encountered during application restarts or re-deployments when setup code runs XGROUP CREATE unconditionally.

Why it happens
  1. 1XGROUP CREATE is called again on a stream that already has a group with the same name.
  2. 2Application startup code creates groups without checking for prior existence.
  3. 3Multiple application instances race to create the same group on startup.
How to reproduce

An application restarts and its initialisation code runs XGROUP CREATE on a group that was created during the first start.

trigger — this will error
trigger — this will error
XGROUP CREATE mystream mygroup $ MKSTREAM
# (application restarts)
XGROUP CREATE mystream mygroup $ MKSTREAM

expected output

(error) BUSYGROUP Consumer Group name already exists

Fix 1

Catch BUSYGROUP and treat it as success

WHEN Group creation is part of idempotent application startup

Catch BUSYGROUP and treat it as success
try:
    redis.xgroup_create("mystream", "mygroup", id="
quot;, mkstream=True) except ResponseError as e: if "BUSYGROUP" in str(e): pass # Group already exists — that is fine else: raise

Why this works

BUSYGROUP means the group already exists in the desired state; catching and ignoring it makes the initialisation idempotent.

Fix 2

Check group existence before creating

WHEN You want explicit control over group lifecycle

Check group existence before creating
# List existing groups on the stream
groups = redis.xinfo_groups("mystream")
existing_names = [g["name"] for g in groups]
if "mygroup" not in existing_names:
    redis.xgroup_create("mystream", "mygroup", id="
quot;)

Why this works

XINFO GROUPS returns metadata for all consumer groups on the stream; only create if absent.

What not to do

Silently swallow all XGROUP CREATE errors

Only BUSYGROUP should be ignored; other errors (e.g., WRONGTYPE) indicate a real problem that must be surfaced.

Version notes
Redis 5.0

Streams and consumer groups introduced; BUSYGROUP error added.

Redis 7.0

No change to BUSYGROUP behaviour.

Sources
Official documentation ↗

Redis Streams — XGROUP CREATE documentation

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Redis errors