Error during SonarQube Scanner execution - Caused by: Input length = 1

Quick Description

  • ALM used: GitHub
  • CI system used: Circle CI
  • Error observed:
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to parse file: /opt/carma/coverage_reports/gcov/#usr#include#boost#format#alt_sstream_impl.hpp.gcov
ERROR: Caused by: Input length = 1
  • Steps to reproduce: run scan via circleci
  • Potential workaround: not clear

Hello, my team is encountering the above described issue when Circle runs our Sonar scans. I suspected this was due to changes introduced to our sonar configs, but when I went to run scans on commits which had previously ran successfully, they failed with the same error. Any idea why this might be?

Hi,
Could you please enable debug logs in the scanner? If you’re using maven, just add -X.
In any case it looks like there is a problem parsing that gcov coverage report. Can you check if the contents of the coverage file are correct?

Hi @jtbaird,

thank you for your report, you are affected by this regression: CPP-2395.

While waiting for a fix you can avoid such issue by changing the encoding of the source file related to the failing report to UTF-8.

1 Like

Here’s the tail of the debug log:

Caused by: java.nio.charset.MalformedInputException: Input length = 1
	at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.io.InputStreamReader.read(InputStreamReader.java:184)
	at java.io.BufferedReader.fill(BufferedReader.java:161)
	at java.io.BufferedReader.readLine(BufferedReader.java:324)
	at java.io.BufferedReader.readLine(BufferedReader.java:389)
	at java.nio.file.Files.readAllLines(Files.java:3205)
	at com.sonar.cpp.plugin.gcov.GcovParser.<init>(GcovParser.java:55)
	... 46 more

Exited with code exit status 1

Looking into the coverage file now.

Please see Massimo’s reply.

Thanks Massimo, the problem is with a file that we believe is generated by sonar:

Unable to parse file: /opt/carma/coverage_reports/gcov/#usr#include#boost#format#alt_sstream_impl.hpp.gcov

Is there something we can do about this?

Hi @jtbaird,

FYI sonar-scanner doesn’t generate any gcov file, if with sonar you mean sonar-scanner.

From my previous reply: