Cssfamily incorrectly detect a file and fail with PayloadTooLargeError: request entity too large

INFO: ------------- Run sensors on module sys
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: 1 source files to be analyzed
sonar-scanner : ERROR: { PayloadTooLargeError: request entity too large
At C:\projects\dokany\scripts\sonar-build.ps1:20 char:17
+ Exec-External { sonar-scanner end /d:sonar.login="$SONAR_LOGIN" }
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (ERROR: { Payloa...ntity too large:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
ERROR:     at readStream (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\raw-body\index.js:155:17)
ERROR:     at getRawBody (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\raw-body\index.js:108:12)
ERROR:     at read (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\body-parser\lib\read.js:77:3)
ERROR:     at jsonParser (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\body-parser\lib\types\json.js:135:5)
ERROR:     at Layer.handle [as handle_request] (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\express\lib\router\layer.js:95:5)
ERROR:     at trim_prefix (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\express\lib\router\index.js:317:13)
ERROR:     at C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\express\lib\router\index.js:284:7
ERROR:     at Function.process_params (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\express\lib\router\index.js:335:12)
ERROR:     at next (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\express\lib\router\index.js:275:10)
ERROR:     at expressInit (C:\projects\dokany\.sonarqube\out\.sonar\mod0\css-bundle\node_modules\express\lib\middleware\init.js:40:5)
ERROR:   message: 'request entity too large',
ERROR:   expected: 218472,
ERROR:   length: 218472,
ERROR:   limit: 102400,
ERROR:   type: 'entity.too.large' }
INFO: 1/1 source files have been analyzed
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=4023ms
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=0ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=63ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: 


  • Steps to reproduce
    Looks like sonar detect a file in https://github.com/dokan-dev/dokany/tree/master/sys as a CSS file and try to analyse it. Is there a way to know what is the file ?
    I am using the public url sonarcloud.io, where can the PayloadTooLargeError: request entity too large error come from ?
  • Potential workaround
    The scan is called from a powershell script with $ErrorActionPreference = “Stop” which stop the scan even if sonar recover from the over and process correctly the analyze. Removing $ErrorActionPreference will ignore the error.

I believe it’s https://github.com/dokan-dev/dokany/blob/master/sys/util/ntstatus_log.inc file which causes the failure. inc is a PHP extension and in CSS sensor we try to analyze CSS inside PHP files as well. You can change the configuration of your project (in SonarCloud UI) to remove inc from PHP extensions.

1 Like

Indeed that was it! Thank you very much for your help very appreciated.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.