BUSYGROUP error
XGROUP CREATE tried to create a consumer group that already exists.
Redis returns this error from XGROUP CREATE when the stream already has a consumer group with that name.
BUSYGROUP Consumer Group name already exists
In client libraries
| Client library | Exception or error type | Message |
|---|---|---|
| redis-py | ResponseError |
BUSYGROUP Consumer Group name already exists |
| Jedis | JedisDataException |
BUSYGROUP Consumer Group name already exists |
| node-redis | SimpleErrorTest with err.message.startsWith('BUSYGROUP') |
BUSYGROUP Consumer Group name already exists |
| Lettuce The async API wraps the exception in an ExecutionException (get()) or a CompletionException (join()). |
RedisBusyException |
BUSYGROUP Consumer Group name already exists |
| go-redis | redis.ErrorTest with redis.HasErrorPrefix(err, "BUSYGROUP") |
BUSYGROUP Consumer Group name already exists |
| ioredis | ReplyErrorTest with err.message.startsWith('BUSYGROUP') |
BUSYGROUP Consumer Group name already exists |
| StackExchange.Redis NRedisStack uses StackExchange.Redis, so it raises the same exceptions. The sync and async APIs raise the same exceptions. |
RedisServerException |
BUSYGROUP Consumer Group name already exists |
| Predis | Predis\Response\ServerExceptionTest with $e->getErrorType() === 'BUSYGROUP' |
BUSYGROUP Consumer Group name already exists |
| redis-rb | Redis::CommandError |
BUSYGROUP Consumer Group name already exists (redis://<host>:<port>) |
| redis-rs The sync and async APIs raise the same errors. |
ErrorKind::ExtensionTest with err.code() == Some("BUSYGROUP") |
"BUSYGROUP": Consumer Group name already exists |
Example
> XGROUP CREATE mystream mygroup $ MKSTREAM
OK
> XGROUP CREATE mystream mygroup $ MKSTREAM
(error) BUSYGROUP Consumer Group name already exists
How to fix it
This error is often harmless. Many apps create their consumer group each time they start, so after the first start, the group already exists. In that case, catch this error in your code and carry on.
- To change where the group starts reading, use
XGROUP SETIDinstead of creating the group again. - To start over, delete the group with
XGROUP DESTROY, and then create it again. Deleting a group also deletes its list of pending messages, which are messages that consumers have read but not yet acknowledged.