Build execution fails due to java.lang.StackOverflowError

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

Executing builds fails due to,

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2007-09-14 09:06:25,016 INFO [BAM:Default Queue:BuildExe] [DefaultErrorHandler] Recording error: Failed to execute build 'BuildResults: "YOUR-BUILD" java.lang.StackOverflowError at sun.nio.cs.UTF_8$Decoder.decodeArrayLoop(UTF_8.java:212) at sun.nio.cs.UTF_8$Decoder.decodeLoop(UTF_8.java:358) at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:544) at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:140) at java.lang.StringCoding.decode(StringCoding.java:173) at java.lang.String.<init>(String.java:444) at java.lang.String.<init>(String.java:516) at java.io.UnixFileSystem.list(Native Method) at java.io.File.list(File.java:973) at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1028) at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1074) at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1074)

Cause

The stack limit for the native JAVA threads has been exceeded, due to nested files/directories in the checked out source code.

Resolution

Re-organize the working directory (your source code) such that, filesystem is not deeply nested.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.