Error in SonarLint for IntelliJ for a new file that has an empty space at the end of its name


  • Java: JetBrains s.r.o.
  • OS: Windows 10 amd64
  • IDE: IntelliJ IDEA 2022.1
  • SonarLint:
java.nio.file.InvalidPathException: Trailing char < > at index 46: terraform/modules/sns/ 
	at java.base/sun.nio.fs.WindowsPathParser.normalize(
	at java.base/sun.nio.fs.WindowsPathParser.parse(
	at java.base/sun.nio.fs.WindowsPathParser.parse(
	at java.base/sun.nio.fs.WindowsPath.parse(
	at java.base/sun.nio.fs.WindowsFileSystem.getPath(
	at java.base/java.nio.file.Path.of(
	at java.base/java.nio.file.Paths.get(
	at c.ij.oa.application.impl.ApplicationImpl$
	at java.base/java.util.concurrent.Executors$
	at java.base/

Hi @andrei-ivanov

This seems to be a limitation of integration between JDK and Windows filesystem. See this bug report for more details:

They seem to say it is normally not valid on Windows to have trailing spaces in filenames. How do you end up in this situation? Are you using a specific filesystem (network attached storage maybe?)

Hmm, there was something strange here… I copied the file name and that white space ended up in the end of it and then right clicked on the folder, chose new file and pasted the name and after I clicked enter I saw that error.
But, AFAIS, the actual created file does not have that empty space at the end, so maybe IDEA did some processing after…

Thanks for the details. I don’t have access to a Windows machine now, but I created a ticket that we will investigate in our next sprint: