Sonarcloud scan error - Error: java.lang.IllegalStateException: Line 461 is out of range

Template for a good new topic, formatted with Markdown:

  • ALM used - Bitbucket Cloud
  • CI system used - bitbucket Cloud
  • Scanner command used when applicable (private details masked) - sonar-scanner/bin/sonar-scanner /usr/bin/sonar-scanner && ln -s /sonar-scanner/bin/sonar-scanner-debug /usr/bin/sonar-scanner-debug
  • Languages of the repository - java
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting) - ‘’''Cannot import coverage information for file ‘core/src/main/java/errorfile.java’, coverage data is invalid. Error: java.lang.IllegalStateException: Line 461 is out of range in the file core/src/main/java/errorfile.java (lines: 460)

This is happening only when a particular developer is raising PR’s not with anyone else, Have tried all the suggestions from internet but issue still remains. I have tried adding extra line in the file which resolved the issue with another file but this particular file still gives error.

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

Welcome to the community!

Where is the coverage report generated? On this developer’s localhost or in the CI?

My first thought here is character encoding. Perhaps this developer, uniquely among your team, uses unicode characters?

Does it happen on every PR from this dev or only sometimes? And if only sometimes, can you see a pattern?

 
Ann