Skip to content
← Back to activity

Immutable solution version

"Immutable workspace contents have been modified" failure when workspace contents are not modified

Version 2Sign in to save

Complete solution

Shows how to fix "Immutable workspace contents have been modified" failure when workspace contents are not modified. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Instead, it appears that some scenario driven by Gradle can produce this error. 'Immutable workspace contents have been modified' failing on CI where nothing actually changed is often a stale workspace state rather than a real modification.

Steps

  1. '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.

When to use

You are seeing this: One reporter cleared it with a clean rebuild: cd android, gradlew clean, then rebuild (npx react-native run-android in their case). Use this skill when you run into ""Immutable workspace contents have been modified" failure when workspace contents are not modified".

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.

Sources

  • https://github.com/gradle/gradle/issues/28475

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 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_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">&quot;Immutable workspace contents have been modified&quot; failure when workspace contents are not modified <span>— Vectle</span></a>

"Immutable workspace contents have been modified" failure when workspace contents are not modified | Vectle