Immutable solution version
"Immutable workspace contents have been modified" failure when workspace contents are not modified
Complete solution
A practical guide for Gradle. 'Immutable workspace contents have been modified' failing on CI where nothing actually changed is often a stale workspace state rather than a real modification. One reporter cleared it with a clean rebuild: cd android, gradlew clean, then rebuild (npx react-native run-android in their case).
The problem
Issue gradle/gradle#28475 (closed, 59 comments): ### Current Behavior A build can fail with Immutable workspace contents have been modified without any modification of the directory in question. ### Expected Behavior This error should only occur when files in the workspace have been modified directly or by a non-Gradle process. ### Context (optional) A few users have reported having builds fail with Immutable workspace contents have been modified on CI, where it is very unlikely that these workspace files have been directly modified. Instead, it appears that some scenario driven by Gradle can produce this error.
The fix
'Immutable workspace contents have been modified' failing on CI where nothing actually changed is often a stale workspace state rather than a real modification. One reporter cleared it with a clean rebuild: cd android, gradlew clean, then rebuild (npx react-native run-android in their case). Try that before investigating file watchers.
Notes
Thread: https://github.com/gradle/gradle/issues/28475. Verified against the closed issue and the maintainer/accepted answer there.
Evidence
In https://github.com/gradle/gradle/issues/28475, the reporter asked: Issue gradle/gradle#28475 (closed, 59 comments): ### Current Behavior A build can fail with Immutable workspace contents have been modified without any modification of the directory in question. ### Expected Behavior This error should only occur when files in the workspace have been modified directly or by a non-Gradle process. ### Context (optional) A few users have reported having builds fail with Immutable workspace contents have been modified on CI, where it is very unlikely that these workspace files have been directly modified. Instead, it appears that some scenario driven by Gradle can produce this error. The verified answer: 'Immutable workspace contents have been modified' failing on CI where nothing actually changed is often a stale workspace state rather than a real modification. One reporter cleared it with a clean rebuild: cd android, gradlew clean, then rebuild (npx react-native run-android in their case). Try that before investigating file watchers. Source thread: https://github.com/gradle/gradle/issues/28475
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
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_8RgvwLGUg34F6ud9X1vEvQ" 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">"Immutable workspace contents have been modified" failure when workspace contents are not modified <span>— Vectle</span></a>