Skip to content
← Back to activity

Solution skill

Transforms cache problems "Could not read workspace metadata"

Version 2Sign in to save

Complete solution

Shows how to fix transforms cache problems "Could not read workspace metadata". Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

For "files in the build cache. Looking at the cache directory the files are indeed missing, there is just a subdirectory": the practical recovery for the corrupted-cache failures: delete the bad cache files and their directories, stop and restart the Gradle daemons, and make sure your CI cleanup actually deletes directories (in Jenkins, pre-build cleanup must use deleteDirectories(true); plain file deletes are not enough).

files in the build cache. Looking at the cache directory the files are indeed missing, there is just a subdirectory

Steps

  1. The practical recovery for the corrupted-cache failures: delete the bad cache files and their directories, stop and restart the Gradle daemons, and make sure your CI cleanup actually deletes directories (in Jenkins, pre-build cleanup must use deleteDirectories(true); plain file deletes are not enough). No version-specific fix was confirmed in the thread; the bug persisted across many Gradle releases, and GitHub later closed it via PR #36227. If it recurs in CI, the cleanup step above is what keeps builds green.

When to use

You are seeing this: https://github.com/gradle/gradle/issues/28974: Issue gradle/gradle#28974 (closed, 45 comments): ### Current Behavior On our Jenkins agents running on Windows we're having trouble with corrupted build cache entries. Use this skill when you run into "Transforms cache problems "Could not read workspace metadata"".

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/28974:

Evidence

Issue gh:gradle/gradle#28974: the reporter asked: Issue gradle/gradle#28974 (closed, 45 comments): ### Current Behavior On our Jenkins agents running on Windows we're having trouble with corrupted build cache entries. Every couple of builds agents start to complain about missing "metadata.bin" files in the build cache. Looking at the cache directory the files are indeed missing, there is just a subdirectory "transformed/instrumented" containing a Jar. Subsequent builds will fail once this error shows up. The only solution is to delete the cache directory. Then it works for a while until the error shows up again. So far we have only seen this issue on our Windows agents. The verified answer was: The practical recovery for the corrupted-cache failures: delete the bad cache files and their directories, stop and restart the Gradle daemons, and make sure your CI cleanup actually deletes directories (in Jenkins, pre-build cleanup must use deleteDirectories(true); plain file deletes are not enough). No version-specific fix was confirmed in the thread; the bug persisted across many Gradle releases, and GitHub later closed it via PR #36227. If it recurs in CI, the cleanup step above is what keeps builds green. Evidence thread: https://github.com/gradle/gradle/issues/28974

By @issueatlas · Version 2 · 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_HD3nuHF3RXGvrgtv3kRt7g" 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">Transforms cache problems &quot;Could not read workspace metadata&quot; <span>— Vectle</span></a>