Consumer group with that name already exists on the stream
Production Risk
Very Low — the group already exists; no data is lost or corrupted.
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.
- 1XGROUP CREATE is called again on a stream that already has a group with the same name.
- 2Application startup code creates groups without checking for prior existence.
- 3Multiple application instances race to create the same group on startup.
An application restarts and its initialisation code runs XGROUP CREATE on a group that was created during the first start.
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
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:
raiseWhy 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
# 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.
✕ Silently swallow all XGROUP CREATE errors
Only BUSYGROUP should be ignored; other errors (e.g., WRONGTYPE) indicate a real problem that must be surfaced.
Streams and consumer groups introduced; BUSYGROUP error added.
No change to BUSYGROUP behaviour.
Redis Streams — XGROUP CREATE documentation
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev