# 错误：在流'mystream'上检测到消费者组'mygroup'的PEL损坏

- **ID:** `redis/stream-consumer-group-pel-corruption`
- **领域:** redis
- **类别:** data_error
- **错误码:** `ERR`
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

消费者组的待处理条目列表（PEL）已损坏，通常是由于异常关闭或流实现中的错误导致内部状态不一致。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 6.2.6 | active | — | — |
| 7.0.8 | active | — | — |
| 7.2.4 | active | — | — |

## 解决方案

1. ```
   使用 `XGROUP SETID mystream mygroup 0-0` 将最后交付的ID重置为开头，然后使用 `XACK mystream mygroup <id1> <id2> ...` 手动确认所有待处理条目以清除PEL。
   ```
2. ```
   如果流不重要，使用 `XREAD COUNT 10000 STREAMS mystream 0` 将流备份，然后删除并重新创建流和消费者组，并重放消息。
   ```

## 无效尝试

- **** — Deleting and recreating the consumer group loses all pending messages and consumer progress, which may cause data loss for unprocessed entries. (70% 失败率)
- **** — Restarting the Redis server does not repair PEL corruption; the corruption persists in the RDB or AOF file. (90% 失败率)
