I am encountering an issue while running the SonarCloud GitHub Action sonarqube-scan-action@v4.2.1. The error arises during the caching process for the sonar-scanner-cli, where the cache is reported as “not found.” As a result, the step to execute the scanner fails with a java: not found error. Below are the relevant portions of the workflow log and code snippet.
Logs:
Run actions/cache@v4
with:
path: /home/runner/work/_temp/sonar-scanner-cli-6.2.1.4610-Linux-X64
key: sonar-scanner-cli-6.2.1.4610-Linux-X64
enableCrossOsArchive: false
fail-on-cache-miss: false
lookup-only: false
save-always: false
env:
SONAR_TOKEN: ***
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
/usr/bin/docker exec abc123def456gh78ij901kl23mnop45qrstuv sh -c “cat /etc/*release | grep ^ID”
Cache not found for input keys: sonar-scanner-cli-6.2.1.4610-Linux-X64
Subsequent Error:
/__w/_temp/sonar-scanner-cli-6.2.1.4610-Linux-X64/bin/sonar-scanner: exec: line 66: /__w/_temp/sonar-scanner-cli-6.2.1.4610-Linux-X64/jre/bin/java: not found
Error: Process completed with exit code 127.
Hi @Adi29,
Thanks for reporting your issue to our community.
The Cache not found for input keys: sonar-scanner-cli-6.2.1.4610-Linux-X64 message informs that the scanner is not in cache (because it was never cached for this combination of OS and Architecture or because the cache has been invalidated).
This is not an issue per se: when there is a cache miss, the install-sonar-scanner-cli.sh is executed, to download the Sonar Scanner CLI. Something like the following:
Run actions/cache@v4
Received 0 of 52684795 (0.0%), 0.0 MBs/sec
Cache Size: ~50 MB (52684795 B)
/usr/bin/tar -xf /home/runner/work/_temp/dbb0cb4f-4739-4b7f-b098-e4ac97e6964d/cache.tzst -P -C /home/runner/work/dart-tools-test1/dart-tools-test1 --use-compress-program unzstd
Received 52684795 of 52684795 (100.0%), 25.1 MBs/sec
Cache restored successfully
Cache restored from key: sonar-scanner-cli-6.2.1.4610-Linux-X64
Run echo "${RUNNER_TEMP}/sonar-scanner-cli-6.2.1.4610-Linux-X64/bin" >> $GITHUB_PATH
Run ${GITHUB_ACTION_PATH}/scripts/run-sonar-scanner-cli.sh -Dsonar.projectKey=dart-project -Dsonar.login=admin -Dsonar.*** --debug
...
I would have a few questions to better understand your scenario:
are you using alpine? If so, could you try using ubuntu-latest, for example?
did it use to work with previous versions of the GitHub Action and stopped working with the new version of the action, or it is a new pipeline being setup?
are you running the GitHub action on a self-hosted runner?
could you share the full logs that come after the actions/cache action execution?
in particular, is the install-sonar-scanner-cli.sh executed correctly?
are you running an antivirus program in your GitHub runner, that may impede the creation (or delete) the java program under jre/bin/?
Hi all,
I’ve run into exactly this problem as well. It’s not really clear to me what is going on. From what I am understanding the problem is not related to the cache miss, it looks like something is going wrong when installing it for the first time - but I am not sure what.
I will attach a run with debug output, maybe that helps you: