Sonar SCM failure no blame data on line 1

Nick Udell picture Nick Udell · Feb 9, 2015 · Viewed 11.3k times · Source

I'm running into some problems executing sonar analysis (Sonar Runner v2.4 and SonarQube 5.0) with SVN on a Windows 7 machine.

I get the following error:

java.lang.IllegalStateException: Unable to blame file DataTypes/TtCallPackagePlanType.cs. No blame info at line 1. Is file commited?

When I execute sonar-runner with the –X flag, it tells me that sonar is executing this blame command:

svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallPackagePlanType.cs

But when I run that command myself in a command prompt at the same location, I get a fully-formed XML file, which you can see at this link:

http://pastebin.com/U2TjxLTs

SVN version is 1.8.10 and I ran svn upgrade on the full directory before executing sonar-runner.

I don’t understand what issue the SVN plugin is having with the blame data.

I can’t attach the full log, as it would be too large for the site (and pastebin), but here are (what I think are) the relevant lines:

01:18:49.335 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallDirection.cs
01:18:49.381 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallOrigin.cs
01:18:49.413 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallOutcome.cs
01:18:49.803 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallPackagePlanType.cs
01:18:49.912 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallReason.cs
01:18:49.959 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallRecordOutcome.cs
01:18:49.974 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallRecordValidity.cs
01:18:50.068 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCallValidity.cs
01:18:50.463 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtChargeEnquiryReportDataType.cs
01:18:50.494 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@1b4cf3[id=1,key=icharge:latest,qualifier=TRK], with key batch-sonar:test
01:18:50.512 DEBUG - Executing: svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert DataTypes/TtCheckOutNumberDetails.cs
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 35.833s
Final Memory: 22M/115M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
        at org.sonar.runner.api.Runner.execute(Runner.java:100)
        at org.sonar.runner.Main.executeTask(Main.java:70)
        at org.sonar.runner.Main.execute(Main.java:59)
        at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: Unable to blame file DataTypes/TtCallPackagePlanType.cs. No blame info at line 1. Is file commited?
        at org.sonar.plugins.scm.svn.SvnBlameConsumer.consumeLine(SvnBlameConsumer.java:135)
        at org.sonar.api.utils.command.CommandExecutor$StreamGobbler.consumeLine(CommandExecutor.java:191)
        at org.sonar.api.utils.command.CommandExecutor$StreamGobbler.run(CommandExecutor.java:177)

Link to sonar-project.properties: http://pastebin.com/xnFyPz67

Link to sonar.properties: http://pastebin.com/q6TaGZQG

Answer

txulu picture txulu · Feb 9, 2017

I had a similar problem:

ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Unable to blame file <path_to_the_file>
    ...
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Missing commit <sha1_of_commit>

in my case it was due to shallow cloning. I had the jenkins job setup in a way that it would always checkout the branches with depth = 1 (to gain time).