Server cache not found for branch analysis

  • ALM used: Bitbucket Cloud
  • CI system used: Bitbucket Cloud
  • Scanner command used: sonar-scanner"src/sonar-bw-output" -Dsonar.cfamily.threads="16" -Dsonar.projectBaseDir="src/" -Dsonar.projectVersion="v8.21.0"
  • Languages of the repository: C++
  • Error observed: Found empty cache on server
  • Steps to reproduce: Manually run a pipeline for a short-lived branch using Bitbucket Cloud UI
  • Potential workaround: None found so far
  • Logs extract: pipelineLog.txt (5.2 KB)


Our team is facing pipeline timeout on Bitbucket Cloud due to very long SonarCloud analysis. Usually, the analysis time can be kept manageable thanks to the server cache. However, when running the analysis for a branch (whether it’s a short-lived or long-lived one), it seems no server cache is used at all. I’m seeing this in the logs:

INFO: Found empty cache on server

According to the documentation, I understand that:

  • SonarCloud tries to maintain a per-branch server cache
  • if no cache is found, the cache from the main branch is used as a fallback

However, what I observe is that:

  • subsequent analysis of the same branch does not benefit from the previous analysis cache if it didn’t complete in due time
  • branch analysis does not fallback to the cache of the main branch

Which leads me to the following questions:

  • Is the server cache only updated after the entire analysis is completed (instead of per-file update)?
  • Is it expected that the cache from main branch isn’t used as a fallback despite what states the docs?

Thank you for your help.


The cache only kicks in for PR analysis.

Could you add -Dsonar.verbose=true to your analysis command and provide the full analysis log, redacted as necessary? It should help us see where the time is going.


1 Like

Oh, does that mean the docs is outdated or that I’m misinterpreting it?

Since it says “For branch analysis, an analysis cache is stored on the server per branch”.

I should add that the server cache is used as expected when triggering an analysis for the main branch.

Sure thing, here it is: sonar-scanner-output-verbose.txt (14.5 MB)


Unfortunately, I’m not able to read that file:


Could you pull a fresh copy of the log from your server, make sure it’s readable on your end and re-upload?


@ganncamp That is surprising, the downloaded file is opening fine for me on Linux, whether I’m using cat, vim or VS Code.

Here is slightly altered version (all line endings converted to LF): sonar-scanner-output-verbose.txt (14.4 MB)


That doesn’t open at all.


I downloaded the file from a totally different computer and I can guarantee that it’s readable.

Can you please try to open the file with a different application? The file is relatively big, maybe the viewer you’re using is struggling because of that.

Also note that the file-encoding is UTF8


I’m still not able to get a readable download of the file, but I asked a colleague to double-check the file for me. It’s readable for him (what’s your OS?) and he pointed out that this is a log for a short-lived branch. The cache only kicks in for PR analysis.


Thanks to you and your colleague.
I’m using Ubuntu 22.04.

Sorry to repeat myself, but I need clarifications.

If the cache “only kicks in for PR analysis”, why the documentation seems to state the opposite? Or maybe I’m misinterpreting it. Since it’s nowhere mentioned that cache isn’t used for branch analysis I’d strongly suggest updating the docs to point it out, if I may.

Unfortunately, as far as I know, not using the cache means for us that there’s no easy way to prevent our analysis from exceeding the allowed time.


Sorry, I forgot we were dealing with a CFamily language. That cache was developed first and works a bit differently than for the rest of the languages.

I’m going to flag this for more expert eyes.


1 Like

We’re back with an update,

After some investigation, it seems this is a valid bug for first-time branch analysis; it should be using the main branch cache but is not for first-time branch analysis.

If you run a second analysis, it will properly use the cache.

I’ve created a ticket internally to track the work and we’ll post updates in this thread with updates. :bowing_man:


1 Like