Sonar scanner failing during Bitbucket Pipelines execution


we’re facing issues with the Bitbucket Pipeline pipe: sonarsource/sonarcloud-scan:1.4.0. Whenever we need to scan a large project, it terminates with:

09:42:42.840 INFO: 75% analyzed
✖ SonarCloud analysis failed. (exit code = 137)
/usr/bin/ line 26: 12 Killed sonar-scanner "${ALL_ARGS[@]}" 2>&1
13 Done | tee "${SCANNER_REPORT}"

I searched online and found an article explaining how to increase the memory. I tried that by adding ‘size: 2x’ to the relevant Bitbucket Pipeline step as well as: SONAR_SCANNER_OPTS: -Xms6G -Xmx6G in order to increase the max memory.

Unfortunately it failed with the following error, this time:

10:06:16.219 INFO: 24% analyzed
10:06:27.427 INFO: 24% analyzed
time="2022-05-30T10:21:15Z" level=error msg="error waiting for container: unexpected EOF"

The pipe ran for 22 minutes before it threw this error. Needless to say 22 minutes in itself is very excessive for this step (you pay for build minutes, so every minute counts!). We have enabled debugging if anyone is interested in seeing the full raw output?


Welcome to the community!

Yes, please do post your analysis logs. And BTW, what language(s) are we talking about here?


Sure here is the full extract (masked sensitive information for security purposes)

output.txt (6.6 MB)

This is a Java based project.


Thanks for sharing the log. I’ll be honest and say I’ve never seen this type of failure before in a SonarQube analysis. It looks like it’s right in the middle of processing the Java files & that’s just not a place for an unexpected EOF to be generated by the analysis itself.

So I searched on the error. This seems to be coming from the container, and it seems to be about the resources available to it. I think this thread should help:



we have indeed bump the docker memory to 2GB. What we’re testing now is the use of SonarScanner for Gradle instead of the sonarcloud-scan pipe. We will continue to test it. It seems like this happens when we scan ‘specific’ source files which SonarCloud doesn’t like. If we exclude it in, then it works. As I’ve mentioned we’re now testing SonarScanner for Gradle instead as an alternative way to scan builds…

So far it’s giving us better mileage.


1 Like