Getting "File name too long" when creating fat jar with sbt



Hi there I think I’m hitting an OS level limit here. I’m getting file name too long on a file name of 245 characters while normally it should be fine up to 255.

I’m using container circleci/openjdk:8u162-jdk-stretch-node-browsers.
Locally the build works fine, I’m on Debian Sid.

The issue from the log file:

[warn] Error extracting zip entry ‘shapeless/TupleTypeableInstances$$anon$22$$anonfun$cast$22$$anonfun$apply$211$$anonfun$apply$212$$anonfun$apply$213$$anonfun$apply$214$$anonfun$apply$215$$anonfun$apply$216$$anonfun$apply$217$$anonfun$apply$218$$anonfun$apply$219$$anonfun$apply$220.class’ to ‘/tmp/build/target/streams/$global/assemblyOption/$global/streams/assembly/8fef703a9b526988a5f06b4b9799ea31507eddbc_f40ed6e303d550293f5f8f3743681d98e31f2360_3cbf73eb02632b77a44de2ed9a68c0c1808b1248/shapeless/TupleTypeableInstances$$anon$22$$anonfun$cast$22$$anonfun$apply$211$$anonfun$apply$212$$anonfun$apply$213$$anonfun$apply$214$$anonfun$apply$215$$anonfun$apply$216$$anonfun$apply$217$$anonfun$apply$218$$anonfun$apply$219$$anonfun$apply$220.class’: /tmp/build/target/streams/$global/assemblyOption/$global/streams/assembly/8fef703a9b526988a5f06b4b9799ea31507eddbc_f40ed6e303d550293f5f8f3743681d98e31f2360_3cbf73eb02632b77a44de2ed9a68c0c1808b1248/shapeless/TupleTypeableInstances$$anon$22$$anonfun$cast$22$$anonfun$apply$211$$anonfun$apply$212$$anonfun$apply$213$$anonfun$apply$214$$anonfun$apply$215$$anonfun$apply$216$$anonfun$apply$217$$anonfun$apply$218$$anonfun$apply$219$$anonfun$apply$220.class (File name too long)

Any idea how this can be fixed?



That is an obscenity :stuck_out_tongue:

The correct answer is “don’t do that” - the length of that file is a red flag for me. However, if you need a workaround, try decompressing the zip file another way. For example, I have sometimes found Alpine unzip to fail, and when I install GNU unzip, it works.

Are you decompressing in the shell or in Java?

Also, it looks like it’s not a CI problem specifically (I can spy a GitHub issue there too):


I know that is a red flag, welcome to the scala compiler :wink:
My problem is that I’m just building a fat jar file so my code + dependencies and those long names come from a dependency. So outside of my control.

Anyway, after some research I found that circleci is not the place to fix it since everything is running on docker and the docker file system used here (AUFS) has a limitation of 240 chars:

From :

Since aufs has several filename prefixes reserved, the maximum filename length is shorter than ordinary 255. Actually 242 (defined as ${AUFS_MAX_NAMELEN}).

I’ll look for another way to fix this.


There are a variety of ways to fix it on the GitHub issue :slight_smile:


You can use long path tool. It worked like charm for me.


I would like to suggest you, try LongPathTool program to resolve this issue.
This tool is very helpful to resolve the issue.