// Redis error reference

BUSYGROUP: Consumer group already exists

XGROUP CREATE found a group with that name on the stream: group names are unique per stream and are not overwritten.

Error prefix
BUSYGROUP
카테고리
Streams and pub/sub
오류 메시지
BUSYGROUP Consumer Group name already exists

의미

Consumer groups are named per stream, and XGROUP CREATE mystream workers refuses when a group called workers is already there. Redis does not overwrite it silently, because the group's read pointer, the last-delivered-id, is state that consumers depend on; re-creating it would rewind or skip history for everyone attached.

The intended pattern for boot code is to treat this error as success: the goal is 'a group named workers exists', not 'this process created it'. There is no create-if-not-exists option, so initialization code catches BUSYGROUP and moves on.

일반적인 원인

  • Startup code creates the group on every boot and does not treat 'already exists' as success.
  • Two services race to create the same group on boot; one wins and the other receives BUSYGROUP.
  • The code was renamed and then reverted, or a name was reused, while the old group still exists on the stream.

Find the cause

XINFO GROUPS mystream
# name, consumers, pending count and last-delivered-id per group
XINFO STREAM mystream
# length, first and last entry ids, for context

해결 방법

  1. List the groups on the stream; that list is the source of truth:

    XINFO GROUPS mystream
  2. Treat BUSYGROUP as success in initialization code, since the desired state already holds.

  3. If the group genuinely must be rebuilt, with consumers re-reading history, delete and recreate it while nothing is attached:

    XGROUP DESTROY mystream workers
    XGROUP CREATE mystream workers 0

Other ways to handle it

Choose the starting id deliberately before retrying creation: 0 replays the stream's history, $ starts at new messages only. For fleets of identical workers, create groups in one deploy step, such as a migration job, rather than inside every process.

안전하게 재현하세요

redis-cli DEL mystream
redis-cli XGROUP CREATE mystream workers $ MKSTREAM
redis-cli XGROUP CREATE mystream workers $
# (error) BUSYGROUP Consumer Group name already exists

질문

Can two groups share a name on different streams?

Yes. Uniqueness is per stream: mystream/workers and events/workers coexist without any problem.

How do I reset a group's position without recreating it?

XGROUP SETID mystream workers $ moves the read pointer to the stream's last entry ID, or to any id, while consumers keep their names and state.

관련 오류

코드와 메시지 텍스트의 출처는 다음과 같습니다 Redis documentation and source code. 전체 목록은 Redis error list 또는 모든 데이터베이스 오류 검색.

// 오류는 줄이고, 수정은 빠르게

Work on Redis in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Redis and the other databases you use.

이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보 인용된 오류 메시지 텍스트의 권리는 해당 데이터베이스 공급업체에 있습니다.