Skip to content
Latchkey

Redis Streams "BUSYGROUP Consumer Group name already exists" in CI

XGROUP CREATE failed because the consumer group already exists on the stream. This is not a real failure: it usually means the create step ran again on a reused stream. The fix is to make group creation idempotent.

What this error means

XGROUP CREATE fails with "BUSYGROUP Consumer Group name already exists", failing a setup step or app startup that does not tolerate it.

Terminal
BUSYGROUP Consumer Group name already exists

Common causes

The group was already created on this stream

A previous setup run or a parallel worker already created the group, so a second XGROUP CREATE is rejected.

A reused Redis kept the group from an earlier run

A persisted Redis retained the consumer group across CI runs, so the fresh create collides.

How to fix it

Tolerate BUSYGROUP as success

Catch the BUSYGROUP error and continue; the group already existing is the desired state.

Terminal
redis-cli XGROUP CREATE events workers $ MKSTREAM || true

Make startup group creation idempotent

Wrap XGROUP CREATE so a BUSYGROUP reply is ignored at app startup.

  1. Call XGROUP CREATE ... MKSTREAM at startup.
  2. Catch the BUSYGROUP reply and treat it as already-created.
  3. Proceed to consume regardless of which run created the group.

How to prevent it

  • Make consumer-group creation idempotent on BUSYGROUP.
  • Prefer an ephemeral Redis per CI run.
  • Create groups once in setup, then let consumers assume they exist.

Frequently asked questions

What causes "Redis "BUSYGROUP Consumer Group name already exists""?
A previous setup run or a parallel worker already created the group, so a second XGROUP CREATE is rejected.
How do I fix Redis "BUSYGROUP Consumer Group name already exists"?
Catch the BUSYGROUP error and continue; the group already existing is the desired state.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card