I am facing a bug when initiating a scan on any project on my SonarQube instance
Versions used: SQ Version 8.5.1
Error observed
##[error]Unhandled Exception:
##[error]Newtonsoft.Json.JsonException: Malformed json response, "actives" field should contain rule 'csharpsquid:S4784'
at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass8_2.<GetActiveRules>b__1(JObject r)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetActiveRules(String qprofile)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
at SonarScanner.MSBuild.BootstrapperClass.Execute()
at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
at SonarScanner.MSBuild.Program.Main(String[] args)
Newtonsoft.Json.JsonException: Malformed json response, "actives" field should contain rule 'csharpsquid:S4784'
at SonarScanner.MSBuild.PreProcessor.SonarWebService.<>c__DisplayClass8_2.<GetActiveRules>b__1(JObject r)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at SonarScanner.MSBuild.PreProcessor.SonarWebService.GetActiveRules(String qprofile)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, List`1& analyzersSettings)
at SonarScanner.MSBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs localSettings)
at SonarScanner.MSBuild.BootstrapperClass.PreProcess()
at SonarScanner.MSBuild.BootstrapperClass.Execute()
at SonarScanner.MSBuild.Program.Execute(String[] args, ILogger logger)
at SonarScanner.MSBuild.Program.Main(String[] args)
Hello,
Can you make a raw call to the SonarQube API supposed to retrieve the rules active in your C# quality profile (QP for short below). This will 2 requests, one to get the QP key first, and then another one to search all rules actives in that QP. You can use your browser to call the below URLs (and of course a cmd line tool like curl if you prefer). Both Queries are GET
Thanks, and sorry because I forgot 1 key parameter for the 2nd request. I need you to run it again. I also add another to get more data (ps=500).
The correct query is:
There must be something wrong either in your search index or in your database (why ? I don’t know right now).
Did the problem appear suddenly (without any change on your platform) or after an upgrade ?
If after an upgrade what was the version before upgrade ?
The first thing I would recommend to do is to re-align the DB contents (master data) and the ES (Search) index. To do that:
Stop SonarQube
Delete the <SONARQUBE_HOME>/data/es6 directory
Restart SonarQube. This will trigger a background rebuild of your index from scratch. Projects data will only accessible progressively as they are indexed. The full reindexing can take from a few minutes (if you have a < 5M LoCs) to potentially hours for platforms with several tenths of millions of LoCs
Once SonarQube is restarted (and no need to wait for the projects reindexing) can you retry the very same last query I requested earlier and send me the results again. I should be able to verify if data integrity is OK.