# org.apache.kafka.common.errors.OffsetCommitRejectedException: 由于时代被隔离，偏移量提交被拒绝

- **ID:** `kafka/offset-commit-rejected-fenced`
- **领域:** kafka
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

消费者组协调器拒绝了偏移量提交，因为消费者的时代已过时，这是由于较新的消费者实例接管导致的。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.5.0 | active | — | — |
| 3.6.0 | active | — | — |

## 解决方案

1. ```
   确保每个消费者实例使用唯一的 group.instance.id，以避免时代冲突；使用基于UUID的ID。
   ```
2. ```
   捕获 OffsetCommitRejectedException 并使用新的消费者实例重新加入组。
   ```
3. ```
   设置 'group.protocol' 为 'consumer'，并通过移除 group.instance.id 禁用静态成员。
   ```

## 无效尝试

- **** — Manual commit still uses same epoch; coordinator rejects if epoch is fenced. (85% 失败率)
- **** — Longer interval delays rebalance but does not fix epoch fencing from duplicate consumers. (70% 失败率)
- **** — Deleting offsets resets group but does not prevent future fencing if same consumer ID is used. (60% 失败率)
