go
io_error
ai_generated
true
remove /tmp/locked.txt: device or resource busy
ID: go/os-remove-file-in-use
80%Fix Rate
86%Confidence
0Evidence
2025-07-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.19 | active | — | — | — |
Root Cause
Attempting to delete a file that is currently open by another process or the same process.
generic中文
尝试删除当前被其他进程或同一进程打开的文件。
Workarounds
-
95% success
if err := file.Close(); err != nil { return err }; if err := os.Remove(path); err != nil { return err } -
80% success
Use os.Rename to a temporary name then remove
Dead Ends
Common approaches that don't work:
-
70% fail
File remains, causing resource leak
-
90% fail
RemoveAll also fails if file is busy