Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
Caused by: org.sonarsource.scanner.lib.internal.http.HttpException: GET https://api.sonarcloud.io/analysis/engine failed with HTTP 403
{"Message":"User is not authorized to access this resource with an explicit deny"}
Steps to reproduce
when running the the github action to perform the sonar analysis
Run args=(-X -Dsonar.organization=sbg-funding -Dsonar.projectKey=SBG-Funding_Email-Automation-Service -Dsonar.scanner.skipJreProvisioning=true -Dsonar.sourceEncoding=UTF-8 -Dsonar.pullrequest.key=222 -Dsonar.pullrequest.branch=EA-229-AddSonarQubeTestCoverage -Dsonar.pullrequest.base=development -Dsonar.pullrequest.provider=github -Dsonar.pullrequest.github.repository=SBG-Funding/Email-Automation-Service)
+ sonar-scanner -Dsonar.projectBaseDir=services/_main/src/src -X -Dsonar.organization=sbg-funding -Dsonar.projectKey=SBG-Funding_Email-Automation-Service -Dsonar.scanner.skipJreProvisioning=true -Dsonar.sourceEncoding=UTF-8 -Dsonar.pullrequest.key=222 -Dsonar.pullrequest.branch=EA-229-AddSonarQubeTestCoverage -Dsonar.pullrequest.base=development -Dsonar.pullrequest.provider=github -Dsonar.pullrequest.github.repository=SBG-Funding/Email-Automation-Service
21:14:40.088 INFO Scanner configuration file: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/conf/sonar-scanner.properties
21:14:40.093 INFO Project root configuration file: /home/runner/work/Email-Automation-Service/Email-Automation-Service/services/_main/src/src/sonar-project.properties
21:14:40.115 INFO SonarScanner CLI 7.1.0.4889
21:14:40.118 INFO Java 17.0.13 Eclipse Adoptium (64-bit)
21:14:40.119 INFO Linux 6.8.0-1030-azure amd64
21:14:40.128 DEBUG Scanner max available memory: 1 GB
21:14:40.155 DEBUG uname -m returned 'x86_64'
21:14:40.157 DEBUG Using JVM default truststore: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/lib/security/cacerts
21:14:40.159 DEBUG Create: /home/runner/.sonar/cache
21:14:40.161 INFO User cache: /home/runner/.sonar/cache
21:14:40.161 DEBUG Create: /home/runner/.sonar/cache/_tmp
21:14:40.291 DEBUG Loading OS trusted SSL certificates...
21:14:40.292 DEBUG This operation might be slow or even get stuck. You can skip it by passing the scanner property 'sonar.scanner.skipSystemTruststore=true'
21:14:40.633 DEBUG Loaded [440] system trusted certificates
21:14:40.902 DEBUG Loaded truststore from '/home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/lib/security/cacerts' containing 152 certificates
21:14:41.078 INFO Communicating with SonarQube Cloud
21:14:41.079 INFO JRE provisioning is disabled
21:14:41.079 INFO Using the java executable '/home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/bin/java' from JAVA_HOME
21:14:41.080 DEBUG Executing: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/bin/java --version
21:14:41.116 DEBUG openjdk 17.0.13 2024-10-15
21:14:41.117 DEBUG OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11)
21:14:41.118 DEBUG OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (build 17.0.13+11, mixed mode, sharing)
21:14:41.164 DEBUG --> GET https://api.sonarcloud.io/analysis/engine
21:14:41.563 DEBUG <-- 403 https://api.sonarcloud.io/analysis/engine (397ms, 82-byte body)
21:14:41.570 INFO EXECUTION FAILURE
21:14:41.571 INFO Total time: 1.487s
21:14:41.571 ERROR Error during SonarScanner CLI execution
java.lang.IllegalStateException: Failed to get the scanner-engine metadata
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.getScannerEngineMetadata(ScannerEngineLauncherFactory.java:84)
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.getScannerEngine(ScannerEngineLauncherFactory.java:66)
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.createLauncher(ScannerEngineLauncherFactory.java:56)
at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.buildNewFacade(ScannerEngineBootstrapper.java:197)
at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.bootstrapCloud(ScannerEngineBootstrapper.java:162)
at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.bootstrap(ScannerEngineBootstrapper.java:149)
at org.sonarsource.scanner.cli.Main.analyze(Main.java:76)
at org.sonarsource.scanner.cli.Main.main(Main.java:64)
Caused by: org.sonarsource.scanner.lib.internal.http.HttpException: GET https://api.sonarcloud.io/analysis/engine failed with HTTP 403
{"Message":"User is not authorized to access this resource with an explicit deny"}
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callUrl(ScannerHttpClient.java:137)
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callApi(ScannerHttpClient.java:121)
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callRestApi(ScannerHttpClient.java:103)
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.getScannerEngineMetadata(ScannerEngineLauncherFactory.java:81)
... 7 common frames omitted
I’m trying to create this for the first time, I see those posts but my user is admin and has all the permissions checked, Administer Organization, Administer, Execute Analysis and Create but not sure why it would keeping rejecting saying it’s 403 forbidden
Hi G Ann, I tried again using a new token, but still getting the same error message:
Caused by: org.sonarsource.scanner.lib.internal.http.HttpException: GET https://api.sonarcloud.io/analysis/engine failed with HTTP 403
{"Message":"User is not authorized to access this resource with an explicit deny"}```
do you think it could be github blocking sonar cloud scanner? or something similar?
Hi G Ann, how are you? do you know if someone else has been able to take a look to this case? do you know if there are other channels to handle this issue? maybe sonnarQube support?
Hi Claire, thanks for helping me with this, I tried what you mentioned but got the following error:
Run SonarSource/sonarqube-scan-action@v5.2.0
Run ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh
Run actions/cache@v4
Cache not found for input keys: sonar-scanner-cli-7.1.0.4889-Linux-X64
Run ${GITHUB_ACTION_PATH}/scripts/install-sonar-scanner-cli.sh
+ mkdir -p /home/runner/work/_temp/sonarscanner
+ cd /home/runner/work/_temp/sonarscanner
+ SCANNER_FILE_NAME=sonar-scanner-cli-7.1.0.4889-linux-x64.zip
+ SCANNER_URI=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.1.0.4889-linux-x64.zip
+ command -v wget
+ wget --no-verbose --user-agent=sonarqube-scan-action https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.1.0.4889-linux-x64.zip
2025-08-08 14:16:31 URL:https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.1.0.4889-linux-x64.zip [57695943/57695943] -> "sonar-scanner-cli-7.1.0.4889-linux-x64.zip" [1]
+ unzip -q -o sonar-scanner-cli-7.1.0.4889-linux-x64.zip
+ SCANNER_UNZIP_FOLDER=sonar-scanner-7.1.0.4889-linux-x64
+ SCANNER_LOCAL_FOLDER=/home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64
+ '[' -d /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64 ']'
+ mv -f sonar-scanner-7.1.0.4889-linux-x64 /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64
Run echo "${RUNNER_TEMP}/sonar-scanner-cli-7.1.0.4889-Linux-X64/bin" >> $GITHUB_PATH
Run args=(-X -Dsonar.organization=sbg-funding -Dsonar.projectKey=SBG-Funding_Email-Automation-Service -Dsonar.scanner.skipJreProvisioning=true -Dsonar.sourceEncoding=UTF-8 -Dsonar.pullrequest.key=222 -Dsonar.pullrequest.branch=EA-229-AddSonarQubeTestCoverage -Dsonar.pullrequest.base=development -Dsonar.pullrequest.provider=github -Dsonar.pullrequest.github.repository=SBG-Funding/Email-Automation-Service
+ sonar-scanner -Dsonar.projectBaseDir=services/_main/src/src -X -Dsonar.organization=sbg-funding -Dsonar.projectKey=SBG-Funding_Email-Automation-Service -Dsonar.scanner.skipJreProvisioning=true -Dsonar.sourceEncoding=UTF-8 -Dsonar.pullrequest.key=222 -Dsonar.pullrequest.branch=EA-229-AddSonarQubeTestCoverage -Dsonar.pullrequest.base=development -Dsonar.pullrequest.provider=github -Dsonar.pullrequest.github.repository=SBG-Funding/Email-Automation-Service
14:16:33.467 INFO Scanner configuration file: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/conf/sonar-scanner.properties
14:16:33.472 INFO Project root configuration file: /home/runner/work/Email-Automation-Service/Email-Automation-Service/services/_main/src/src/sonar-project.properties
14:16:33.491 INFO SonarScanner CLI 7.1.0.4889
14:16:33.493 INFO Java 17.0.13 Eclipse Adoptium (64-bit)
14:16:33.493 INFO Linux 6.8.0-1031-azure amd64
14:16:33.502 DEBUG Scanner max available memory: 1 GB
14:16:33.524 DEBUG uname -m returned 'x86_64'
14:16:33.527 DEBUG Using JVM default truststore: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/lib/security/cacerts
14:16:33.528 DEBUG Create: /home/runner/.sonar/cache
14:16:33.529 INFO User cache: /home/runner/.sonar/cache
14:16:33.529 DEBUG Create: /home/runner/.sonar/cache/_tmp
14:16:33.672 DEBUG Loading OS trusted SSL certificates...
14:16:33.673 DEBUG This operation might be slow or even get stuck. You can skip it by passing the scanner property 'sonar.scanner.skipSystemTruststore=true'
14:16:34.012 DEBUG Loaded [440] system trusted certificates
14:16:34.288 DEBUG Loaded truststore from '/home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/lib/security/cacerts' containing 152 certificates
14:16:34.475 INFO Communicating with SonarQube Cloud
14:16:34.476 INFO JRE provisioning is disabled
14:16:34.479 INFO Using the java executable '/home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/bin/java' from JAVA_HOME
14:16:34.481 DEBUG Executing: /home/runner/work/_temp/sonar-scanner-cli-7.1.0.4889-Linux-X64/jre/bin/java --version
14:16:34.517 DEBUG openjdk 17.0.13 2024-10-15
14:16:34.518 DEBUG OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11)
14:16:34.518 DEBUG OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (build 17.0.13+11, mixed mode, sharing)
14:16:34.562 DEBUG --> GET https://api.sonarcloud.io/analysis/engine
14:16:34.964 DEBUG <-- 403 https://api.sonarcloud.io/analysis/engine (401ms, 82-byte body)
14:16:34.971 INFO EXECUTION FAILURE
14:16:34.972 INFO Total time: 1.508s
14:16:34.972 ERROR Error during SonarScanner CLI execution
java.lang.IllegalStateException: Failed to get the scanner-engine metadata
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.getScannerEngineMetadata(ScannerEngineLauncherFactory.java:84)
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.getScannerEngine(ScannerEngineLauncherFactory.java:66)
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.createLauncher(ScannerEngineLauncherFactory.java:56)
at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.buildNewFacade(ScannerEngineBootstrapper.java:197)
at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.bootstrapCloud(ScannerEngineBootstrapper.java:162)
at org.sonarsource.scanner.lib.ScannerEngineBootstrapper.bootstrap(ScannerEngineBootstrapper.java:149)
at org.sonarsource.scanner.cli.Main.analyze(Main.java:76)
at org.sonarsource.scanner.cli.Main.main(Main.java:64)
Caused by: org.sonarsource.scanner.lib.internal.http.HttpException: GET https://api.sonarcloud.io/analysis/engine failed with HTTP 403
{"Message":"User is not authorized to access this resource with an explicit deny"}
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callUrl(ScannerHttpClient.java:137)
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callApi(ScannerHttpClient.java:121)
at org.sonarsource.scanner.lib.internal.http.ScannerHttpClient.callRestApi(ScannerHttpClient.java:103)
at org.sonarsource.scanner.lib.internal.facade.forked.ScannerEngineLauncherFactory.getScannerEngineMetadata(ScannerEngineLauncherFactory.java:81)
... 7 common frames omitted
I created a new secret from Security section in sonarQube, then updated it in github secrets.
This is how the pipeline is looking now:
Could you try to run the Sonar Scanner from your local computer using the same token?
You can go to your project Administration menu → Analysis method, and select the “Manually” box at the bottom right and follow the instructions to set it up.
If you get the same error, it means there is an issue with your token and/or the permissions of the associated user. If you don’t, it means the issue is in the pipeline configuration.