Gradle times out waiting for the journal cache lock
Timeout waiting to lock journal cacheShort answer
Another Gradle process holds the lock on the journal cache in your Gradle user home and this build waited in vain. Stop all daemons first. If it comes back on a Mac with a firewall or endpoint security tool, upgrade Gradle to 8.12.1 or newer.
Fix it fast
1Find out which cause you have
List the Gradle daemons that are running, because a stale one is the usual holder of the lock.
./gradlew --status jps | grep GradleDaemon2Match what you see, then jump to its fix
- 1
The message names an owner process ID, and jps shows a GradleDaemon with that ID.A leftover or second Gradle daemon holds the lockFix - 2
The error repeats on macOS 15 with a firewall, VPN or endpoint security tool, with a Broken pipe in FileLockCommunicator.Firewall or endpoint security blocks daemon communicationFix
- 1
What does the error look like?
Timeout waiting to lock journal cacheIt is currently in use by another Gradle instance.org.gradle.cache.LockTimeoutException
Cause 1 of 2
A leftover or second Gradle daemon holds the lock
1Check
gradle --status lists daemons of the version you use; jps lists live daemons of every Gradle version.
./gradlew --status2Fix
Stop the daemons of this version, and kill daemons of other versions by process ID.
./gradlew --stop
kill <pid-from-jps>3Verify
Run any build.
./gradlew helpConfirmed by docs.gradle.org
Cause 2 of 2
Firewall or endpoint security blocks daemon communication
1Check
A Gradle issue traces the timeout to macOS 15, its firewall and security products dropping the sockets that daemons use to ask each other to release a lock.
./gradlew --version2Fix
Use Gradle 8.12.1 or newer, which made the lock communication more robust, then stop old daemons because a daemon started by an older version can still hold a bad lock.
./gradlew --stop
./gradlew wrapper --gradle-version 8.12.13Verify
Check the version and run a build.
./gradlew --version
./gradlew helpConfirmed by github.com
How do I stop it coming back?
- Use the same Gradle version and JDK in every project so fewer daemons start.
- Do not delete lock files by hand; reports say it can leave the cache corrupted.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Spring Boot will not start because port 8080 is already taken
Action: Identify and stop the process that's listening on port 8080 or configure this application to listen on another port.
Spring Boot listens on 8080 unless told otherwise, and only one process can own a port.
3 causes, each with a fixBack end
Android gets HTML instead of JSON from a PHP API
org.json.JSONException: Value <br of type java.lang.String cannot be converted to JSONObject
The response body is not JSON.
2 causes, each with a fixBack end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
Application Load Balancer returns 502 for a Node.js target
HTTPCode_ELB_502_Count
An ALB returns 502 when the target gives it something it cannot use: a refused or reset connection, a connection closed mid-request, a bad response, or a header over 32 K.
4 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fix