Http status NotFound when running dotnet sonarscanner

Hi, I’m having a problem with dotnet sonarscanner. Every time it tries to reach /api/settings/values, the scanner fails with Http status code is NotFound. error.

Environment:

  • SonarQube version: Community Build / v25.7.0.110598 / MQR Mode
  • SonarQube deployed in AWS EKS using Helm Chart
  • Dotnet version: 6.0

The endpoint is reachable using my local browser and curl. Below are the log files when I tried to run dotnet sonarscanner using docker image (mcr.microsoft.com/dotnet/sdk:6.0).

root@35ed117c7c20:/app# SONAR_HOST_URL=https://example.com
root@35ed117c7c20:/app# SONAR_TOKEN=sqp_example

# CURL WORKS
root@35ed117c7c20:/app# curl -u "$SONAR_TOKEN": "$SONAR_HOST_URL"/api/settings/values
{"settings":[{"key":"sonar.cs.ignoreHeaderComments","value":"true","inherited":true},{"key":"sonar.typescript.file.suffixes","values":[".ts",".tsx",".cts",".mts"],"inherited":true},{"key":"sonar.ai.codefix.hidden","value":"false","inherited":true},{"key":"sonar.python.xunit.skipDetails","value":"false","inherited":true},{"key":"sonar.ipynb.file.suffixes","values":["ipynb"],"inherited":true},{"key":"sonar.auth.saml.signature.enabled","value":"false","inherited":true},{"key":"sonar.go.exclusions","values":["**/vendor/**"],"inherited":true},{"key":"sonar.terraform.file.suffixes","values":[".tf"],"inherited":true},{"key":"sonar.forceAuthentication","value":"true","parentValue":"true"},{"key":"sonar.notifications.delay","value":"60","inherited":true},{"key":"sonar.multi-quality-mode.enabled","value":"true","parentValue":"true"},{"key":"sonar.rust.file.suffixes","values":[".rs"],"inherited":true},{"key":"sona..." #truncated

# SONARSCANNER RETURNS Http NotFound ERROR
root@35ed117c7c20:/app# dotnet sonarscanner begin /k:"example-759b-42f6-b20c-b434bba165a6" /d:sonar.token="$SONAR_TOKEN" /d:"sonar.host.url=$SONAR_HOST_URL" 
SonarScanner for MSBuild 10.3
Using the .NET Core version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
03:01:31.806  Updating build integration targets...
03:01:32.058  Using SonarQube v25.7.0.110598.
03:01:32.227  The JRE provisioning is a time consuming operation.
JRE provisioned: OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz.
If you already have a compatible java version installed, please add either the parameter "/d:sonar.scanner.skipJreProvisioning=true" or "/d:sonar.scanner.javaExePath=<PATH>".
03:01:34.419  Fetching analysis configuration settings...
03:01:34.431  Downloading from https://example.com/api/settings/values failed. Http status code is NotFound.
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 's')
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarWebServer.ParseSettingsResponse(String contents)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarWebServer.DownloadComponentProperties(String component)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarQubeWebServer.DownloadComponentProperties(String component)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarWebServer.DownloadProperties(String projectKey, String projectBranch)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.FetchArgumentsAndRuleSets(ISonarWebServer server, ProcessedArgs args, BuildSettings settings)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.DoExecute(ProcessedArgs localSettings)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.Execute(IEnumerable`1 args)
   at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
   at SonarScanner.MSBuild.BootstrapperClass.Execute()
   at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
   at SonarScanner.MSBuild.Program.Execute(String[] args)
   at SonarScanner.MSBuild.Program.Main(String[] args)
   at SonarScanner.MSBuild.Program.<Main>(String[] args)

Verbose log output for more information

root@c1f4adf9019c:/ dotnet sonarscanner begin /k:"example-759b-42f6-b20c-b434bba165a6" /d:sonar.token="$SONAR_TOKEN" /d:"sonar.host.url=$SONAR_HOST_URL" /d:sonar.verbose=true
SonarScanner for MSBuild 10.3
Using the .NET Core version of the Scanner for MSBuild
Default properties file was found at /root/.dotnet/tools/.store/dotnet-sonarscanner/10.3.0/dotnet-sonarscanner/10.3.0/tools/netcoreapp3.1/any/SonarQube.Analysis.xml
Loading analysis properties from /root/.dotnet/tools/.store/dotnet-sonarscanner/10.3.0/dotnet-sonarscanner/10.3.0/tools/netcoreapp3.1/any/SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
03:24:41.521  Loading analysis properties from /root/.dotnet/tools/.store/dotnet-sonarscanner/10.3.0/dotnet-sonarscanner/10.3.0/tools/netcoreapp3.1/any/SonarQube.Analysis.xml
03:24:41.549  Server Url: https://example.com
03:24:41.549  Api Url: https://example.com/api/v2
03:24:41.549  Is SonarCloud: False
03:24:41.552  No truststore provided; attempting to use the default location.
03:24:41.554  No truststore found at the default location; proceeding without a truststore.
03:24:41.557  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
03:24:41.558  Updating build integration targets...
03:24:41.562  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/4.0/Microsoft.Common.targets/ImportBefore
03:24:41.562  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/10.0/Microsoft.Common.targets/ImportBefore
03:24:41.562  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/11.0/Microsoft.Common.targets/ImportBefore
03:24:41.563  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/12.0/Microsoft.Common.targets/ImportBefore
03:24:41.563  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/14.0/Microsoft.Common.targets/ImportBefore
03:24:41.563  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore
03:24:41.563  Installed SonarQube.Integration.ImportBefore.targets to /root/.local/share/Microsoft/MSBuild/Current/Microsoft.Common.targets/ImportBefore
03:24:41.564  Installed SonarQube.Integration.ImportBefore.targets to /root/Microsoft/MSBuild/15.0/Microsoft.Common.targets/ImportBefore
03:24:41.564  Installed SonarQube.Integration.ImportBefore.targets to /root/Microsoft/MSBuild/Current/Microsoft.Common.targets/ImportBefore
03:24:41.565  Installed SonarQube.Integration.targets to /.sonarqube/bin/targets
03:24:41.565  Creating config and output folders...
03:24:41.566  Creating directory: /.sonarqube/conf
03:24:41.566  Creating directory: /.sonarqube/out
03:24:41.581  Downloading from https://example.com/api/settings/values?component=unknown...
03:24:41.823  Response received from https://example.com/api/settings/values?component=unknown...
03:24:41.826  Fetching server version...
03:24:41.829  Downloading from https://example.com/api/v2/analysis/version...
03:24:41.863  Response received from https://example.com/api/v2/analysis/version...
03:24:41.869  Using SonarQube v25.7.0.110598.
03:24:41.871  Checking if the server version is supported...
03:24:41.879  Checking validity of server license...
03:24:41.88  Downloading from https://example.com/api/editions/is_valid_license...
03:24:41.896  Response received from https://example.com/api/editions/is_valid_license...
03:24:41.945  SonarQube Community Edition detected, license is valid.
03:24:41.947  JreResolver: Resolving JRE path.
03:24:41.95  Downloading from https://example.com/api/v2/analysis/jres?os=linux&arch=x64...
03:24:41.961  Response received from https://example.com/api/v2/analysis/jres?os=linux&arch=x64...
03:24:42.08  JreResolver: Cache miss. Attempting to download JRE.
03:24:42.084  Starting the Java Runtime Environment download.
03:24:42.085  The JRE provisioning is a time consuming operation.
JRE provisioned: OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz.
If you already have a compatible java version installed, please add either the parameter "/d:sonar.scanner.skipJreProvisioning=true" or "/d:sonar.scanner.javaExePath=<PATH>".
03:24:42.086  Downloading Java JRE from analysis/jres/239eae93-1efe-4b56-8446-b431dfcdf828.
03:24:42.087  Downloading from https://example.com/api/v2/analysis/jres/239eae93-1efe-4b56-8446-b431dfcdf828...
03:24:42.337  Response received from https://example.com/api/v2/analysis/jres/239eae93-1efe-4b56-8446-b431dfcdf828...
03:24:42.526  The checksum of the downloaded file is '4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff' and the expected checksum is '4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff'.
03:24:42.527  Starting extracting the Java runtime environment from archive '/root/.sonar/cache/4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff/OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz' to folder '/root/.sonar/cache/4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff/pghwzytf.m5u'.
03:24:44.466  Moving extracted Java runtime environment from '/root/.sonar/cache/4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff/pghwzytf.m5u' to '/root/.sonar/cache/4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff/OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz_extracted'.
03:24:44.467  The Java runtime environment was successfully added to '/root/.sonar/cache/4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff/OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz_extracted'.
03:24:44.468  JreResolver: Download success. JRE can be found at '/root/.sonar/cache/4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff/OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz_extracted/jdk-17.0.13+11-jre/bin/java'.
03:24:44.474  Fetching analysis configuration settings...
03:24:44.477  Fetching properties for project 'example-759b-42f6-b20c-b434bba165a6'...
03:24:44.478  Downloading from https://example.com/api/settings/values?component=example-759b-42f6-b20c-b434bba165a6...
03:24:44.481  Response received from https://example.com/api/settings/values?component=example-759b-42f6-b20c-b434bba165a6...
03:24:44.483  No settings for project example-759b-42f6-b20c-b434bba165a6. Getting global settings...
03:24:44.483  Downloading from https://example.com/api/settings/values...
03:24:44.485  Response received from https://example.com/api/settings/values...
03:24:44.486  Downloading from https://example.com/api/settings/values failed. Http status code is NotFound.
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 's')
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarWebServer.ParseSettingsResponse(String contents)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarWebServer.DownloadComponentProperties(String component)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarQubeWebServer.DownloadComponentProperties(String component)
   at SonarScanner.MSBuild.PreProcessor.WebServer.SonarWebServer.DownloadProperties(String projectKey, String projectBranch)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.FetchArgumentsAndRuleSets(ISonarWebServer server, ProcessedArgs args, BuildSettings settings)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.DoExecute(ProcessedArgs localSettings)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.Execute(IEnumerable`1 args)
   at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
   at SonarScanner.MSBuild.BootstrapperClass.Execute()
   at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
   at SonarScanner.MSBuild.Program.Execute(String[] args)
   at SonarScanner.MSBuild.Program.Main(String[] args)
   at SonarScanner.MSBuild.Program.<Main>(String[] args)

Hello @fftrf,

This looks super weird. Can you please trying to run curl with the same user-agent as the scanner?