# Gradle Wrapper throws FileNotFoundException

**URL:** <https://discuss.gradle.org/t/gradle-wrapper-throws-filenotfoundexception/18633>\
**Category:** Bugs\
**Tags:** not-a-bug\
**Created:** [July 22, 2016, 12:39pm UTC](https://discuss.gradle.org/t/gradle-wrapper-throws-filenotfoundexception/18633 "2016-07-22T12:39:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![n\_s\_skvortsov](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/n_s_skvortsov/32/1011_2.png) [@n\_s\_skvortsov](https://discuss.gradle.org/u/n_s_skvortsov)\
**Post date:** [July 22, 2016, 12:39pm UTC](https://discuss.gradle.org/t/gradle-wrapper-throws-filenotfoundexception/18633/1 "2016-07-22T12:39:28Z")

</div>

From time to time, Gradle Wrapper fails with exception:

Exception in thread “main” java.io.FileNotFoundException: /home/teamcity/.gradle/wrapper/dists/gradle-2.14-bin/76oc0mnc3ieqtsukq90mp0rxk/gradle-2.14-bin.zip.lck (No such file or directory)  
[01:33:30][Step 1/1] at java.io.RandomAccessFile.open0(Native Method)  
[01:33:30][Step 1/1] at java.io.RandomAccessFile.open(RandomAccessFile.java:316)  
[01:33:30][Step 1/1] at java.io.RandomAccessFile.(RandomAccessFile.java:243)  
[01:33:30][Step 1/1] at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:49)  
[01:33:30][Step 1/1] at org.gradle.wrapper.Install.createDist(Install.java:48)  
[01:33:30][Step 1/1] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)  
[01:33:30][Step 1/1] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)  
[01:33:30][Step 1/1] Process exited with code 1

What this bin.zip.lck is for, and what can cause the issue?

Gradle Version: 2.14  
Operating System: Ubuntu 14.04

Link to CI build [https://teamcity.jetbrains.com/viewLog.html?tab=buildLog&logTab=tree&filter=debug&expand=all&buildId=824481#\_focus=49](https://teamcity.jetbrains.com/viewLog.html?tab=buildLog&logTab=tree&filter=debug&expand=all&buildId=824481#_focus=49)  
Project sources: [https://github.com/JetBrains/Grammar-Kit](https://github.com/JetBrains/Grammar-Kit)

---

<div class="post-metadata">

**Author:** ![Stefan\_Wolf](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/stefan_wolf/32/5519_2.png) [@Stefan\_Wolf](https://discuss.gradle.org/u/Stefan_Wolf)\
**Post date:** [August 18, 2016, 11:41am UTC](https://discuss.gradle.org/t/gradle-wrapper-throws-filenotfoundexception/18633/2 "2016-08-18T11:41:28Z")

</div>

Hi,

thank you for your Bug report.

After looking into this I suppose this happens when the user running Gradle does not have write access to the Gradle home directory (`/home/teamcity/.gradle` in your case).

Have you been able to fix the problem, yet?

Regards,  
Stefan

---

<div class="post-metadata">

**Author:** ![n\_s\_skvortsov](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/n_s_skvortsov/32/1011_2.png) [@n\_s\_skvortsov](https://discuss.gradle.org/u/n_s_skvortsov)\
**Post date:** [August 18, 2016, 12:01pm UTC](https://discuss.gradle.org/t/gradle-wrapper-throws-filenotfoundexception/18633/3 "2016-08-18T12:01:29Z")

</div>

Hello Stefan,

This problem appears from time to time on TeamCity’s cloud agent. Next time I see the erorr, I will check the permissions and come back with more information.
