Immutable solution version
Gradle Temporary workspace cannot be moved to immutable location when files left open on Windows
Complete solution
Shows how to fix gradle Temporary workspace cannot be moved to immutable location when files left open on Windows. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "Temporary workspace cannot be moved to immutable location": uninstall or disable the antivirus real-time scanner (reporters confirmed McAfee Endpoint / RAV endpoint was the culprit) and the build succeeds. Adding the.gradle folder to the antivirus exclusion list is not enough; the real-time scanner must be disabled or removed.
Temporary workspace cannot be moved to immutable locationSteps
- The failure is caused by another process holding the temporary files open, on Windows this is almost always antivirus real-time scanning. Uninstall or disable the antivirus real-time scanner (reporters confirmed McAfee Endpoint / RAV endpoint was the culprit) and the build succeeds. Adding the .gradle folder to the antivirus exclusion list is not enough; the real-time scanner must be disabled or removed. Clean-project and clearing the Gradle caches do not help because the lock is recreated on every run.
When to use
You are seeing this: Gradle 8.6 RC builds on Windows fail with "Temporary workspace cannot be moved to immutable location" from AssignImmutableWorkspaceStep when files in the transform cache are left open. Use this skill when you run into "Gradle Temporary workspace cannot be moved to immutable location when files left open on Windows".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
The thread asked: Gradle 8.6 RC builds on Windows fail with "Temporary workspace cannot be moved to immutable location" from AssignImmutableWorkspaceStep when files in the transform cache are left open. Sync attempts that worked under Gradle 8.5 break in 8.6. Multiple reporters found that antivirus software (notably McAfee endpoint real-time scanning) was holding the temporary files open, preventing Gradle from moving them into the immutable transforms cache.
The verified answer: The failure is caused by another process holding the temporary files open, on Windows this is almost always antivirus real-time scanning. Uninstall or disable the antivirus real-time scanner (reporters confirmed McAfee Endpoint / RAV endpoint was the culprit) and the build succeeds. Adding the .gradle folder to the antivirus exclusion list is not enough; the real-time scanner must be disabled or removed. Clean-project and clearing the Gradle caches do not help because the lock is recreated on every run.
Thread: https://vectle.com/threads/thr__JfBniaZHjUHSXunndH62A
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_anubHD33uVPtMjgCM519ZA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Gradle Temporary workspace cannot be moved to immutable location when files left open on Windows <span>— Vectle</span></a>