# RuntimeError: File response is already started

- **ID:** `python/fastapi-file-response-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

尝试在响应已经开始发送后再次修改或发送文件。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   确保只返回一次 `FileResponse`，不要在返回后修改。
   ```
2. **** (85% success)
   ```
   使用 `StreamingResponse` 并正确管理生成器生命周期。
   ```

## Dead Ends

- **** — 尝试在返回 `FileResponse` 后继续写入响应，导致错误。 (70% fail)
- **** — 尝试在流式响应中使用 `yield` 但未正确管理生成器。 (60% fail)
