# 数据丢失错误：记录在位置12345处损坏：校验和不匹配

- **ID:** `tensorflow/data-loss-corrupted-event-file`
- **领域:** tensorflow
- **类别:** data_error
- **错误码:** `DLC`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

TensorBoard事件文件或TFRecord文件损坏，通常由写入不完整或磁盘故障引起。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| tensorflow 2.15.0 | active | — | — |
| tensorboard 2.15.0 | active | — | — |

## 解决方案

1. ```
   Identify and remove the corrupted event file: locate the file (e.g., events.out.tfevents.12345), then delete it and restart TensorBoard. Example:
rm /path/to/logs/events.out.tfevents.12345
tensorboard --logdir /path/to/logs
   ```
2. ```
   Use tf.data to skip corrupted records during TFRecord reading:
import tensorflow as tf
raw_dataset = tf.data.TFRecordDataset(['data.tfrecord'])
filtered_dataset = raw_dataset.ignore_errors()
for record in filtered_dataset:
    # process record
    pass
   ```

## 无效尝试

- **** — Does not address root cause of file corruption. (85% 失败率)
- **** — Overly destructive; only the corrupted file needs removal. (95% 失败率)
