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

- **ID:** `redis/stream-consumer-group-invalid-id`
- **领域:** redis
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Redis 6.2 | active | — | — |
| Redis 7.0 | active | — | — |
| Redis 7.2 | active | — | — |

## 解决方案

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

## 无效尝试

- **Recreate the stream key with the same name** — Deletes all stream data and existing consumer groups; the group still won't exist unless explicitly created. (60% 失败率)
- **Use XINFO GROUPS mystream to list groups, but not create one** — Only lists groups; does not resolve the missing group error. (80% 失败率)
