redis type_error ai_generated true

错误:无效的消费者组 ID:组 'mygroup' 不存在

ERR: Invalid consumer group ID: group 'mygroup' does not exist

ID: redis/stream-consumer-group-invalid-id

其他格式: JSON · Markdown 中文 · English
92%修复率
84%置信度
1证据数
2024-02-28首次发现

版本兼容性

版本状态引入弃用备注
Redis 6.2 active
Redis 7.0 active
Redis 7.2 active

根因分析

命令引用了一个在指定流键上尚未创建的消费者组。

English

A command referenced a consumer group that has not been created on the specified stream key.

generic

官方文档

https://redis.io/docs/latest/develop/data-types/streams/

解决方案

  1. 使用 XGROUP CREATE mystream mygroup $(或 0 表示所有消息)创建消费者组。例如:redis-cli XGROUP CREATE mystream mygroup $。
  2. 在使用 XREADGROUP 之前,使用 XINFO GROUPS mystream 验证组是否存在。

无效尝试

常见但无效的做法:

  1. Recreate the stream key with the same name 60% 失败

    Deletes all stream data and existing consumer groups; the group still won't exist unless explicitly created.

  2. Use XINFO GROUPS mystream to list groups, but not create one 80% 失败

    Only lists groups; does not resolve the missing group error.