# 发布工件失败：设备上没有空间（28）

- **ID:** `cicd/teamcity-build-agent-disk-full`
- **领域:** cicd
- **类别:** system_error
- **错误码:** `28`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

TeamCity 构建代理的磁盘已满，由于存储空间不足，无法发布工件或执行构建。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| TeamCity 2022.04+ | active | — | — |
| TeamCity 2023.05+ | active | — | — |
| Linux build agents | active | — | — |

## 解决方案

1. ```
   Stop the TeamCity build agent (`teamcity-agent stop`), clean up old build artifacts and temp files in `<agent-home>/work/` and `<agent-home>/temp/`, then restart the agent (`teamcity-agent start`).
   ```
2. ```
   Configure the agent to use a different partition with more space by setting `workDir` and `tempDir` in `<agent-home>/conf/buildAgent.properties`: `workDir=/mnt/large_disk/work` and `tempDir=/mnt/large_disk/temp`
   ```

## 无效尝试

- **Clearing the build agent's temp directory manually without stopping the agent** — The agent may be actively writing to some files, causing deletion failures or file locks; stopping the agent is required for safe cleanup. (40% 失败率)
- **Increasing the disk size on the host machine without reconfiguring the agent's build checkout directory** — If the disk is partitioned, increasing the partition may not be possible without downtime, and the agent's build directory may still point to a full partition. (60% 失败率)
