Setting files in 'sonar.exclusions' will still make them fail analysis

I have a few file/folder names which are not UTF-8 in my project. I have added the pattern of these files into the ‘sonar.exclusions’ property and, since these are .py files and all we want to analysis are .cpp/.c/.h/.hpp files, I have also placed these correct extensions into the file ‘sonar.includes’ property. However, sonar scanner still throws an error. I guess the file names are first being obtained and only after the matching patterns are discarded.

  • Using SonarScanner version
  • Trying to upload findings to SonarQube using Sonar Scanner

Is there any way of avoiding this behavior? I am currently blocked because the file renaming cannot be done, so I think it should be possible to simply ignore all folders with a certain pattern for this not to happen


Welcome to the community!

Can you share your analysis logs?



Thank you! Sorry for the late reply, but I have been on vacation.

I can’t show the entire error, because I have some sensitive information. But the traceback is something like this:

15:53:38.930 INFO: ------------------------------------------------------------------------
15:53:38.931 INFO: ------------------------------------------------------------------------
15:53:38.931 INFO: Total time: 14.619s
15:53:39.020 INFO: Final Memory: 8M/68M
15:53:39.020 INFO: ------------------------------------------------------------------------
15:53:39.020 ERROR: Error during SonarScanner execution
java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters:

Then it outputs a python file that has a zero width space. The issue is my file looks like this:

# Path is relative to the file. Defaults to .


# Encoding of the source code. Default is default system encoding


# Narrowing down to files of interest


sonar.inclusions=**/*.cpp, **/*.c, **/*.cc, **/*.h, **/*.hpp


I even added python files to sonar.exclusions property, but it gives the same error.
Any help is appreciated!

Thank you and best regards!



I need at least a few lines leading up to the error to know where in the process analysis was. Feel free to redact the log as necessary.