SCM jgit: Failed to find all committed files

  • SonarQube 9.6.0.59041
  • SonarScanner 4.7.0.2747

Similar issue as:

But the CI platform is Bamboo, so the TeamCity workaround can’t be used.

A git repack before scanning does work around the issue.

 INFO: SCM Publisher SCM provider for this project is: git
 INFO: SCM Publisher 22 source files to be analyzed
 INFO: This git repository references another local repository which is not well supported. SCM information might be missing for some files. You can avoid borrow objects from another local repository by not using --reference or --shared when cloning it.
 INFO: SCM Publisher 0/22 source files have been analyzed (done) | time=138ms
 ERROR: Error during SonarScanner execution
 java.lang.IllegalStateException: Failed to find all committed files
        at org.sonar.scm.git.CompositeBlameCommand.collectAllCommittedFiles(CompositeBlameCommand.java:124)
        at org.sonar.scm.git.CompositeBlameCommand.blame(CompositeBlameCommand.java:76)
        at org.sonar.scanner.scm.ScmPublisher.publish(ScmPublisher.java:84)
        at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:366)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:135)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
 Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 6af7d2a9d537a4720ecba336a4d3c8798bfdbce1
        at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135)
        at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:214)
        at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1086) 
        at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:996) 
        at org.sonar.scm.git.CompositeBlameCommand.collectAllCommittedFiles(CompositeBlameCommand.java:111)
        ... 22 more
 ERROR:
 ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

The commit shows up in the log:

$ git log | head -2
6af7d2a9d537a4720ecba336a4d3c8798bfdbce1 -  (HEAD -> trunk, origin/trunk) INFRA-1214 : generate Key ID using method from rfc7638 (2022-09-02 11:28:28 +0200) <gert@work>
62f1ead72e5cfaa87e069f119b125920c7081d79 -  Release 0.9.1 (2022-06-30 08:22:52 +0200) <gert@work>

Hi,

Welcome to the community!

I see this in your log:

Can you share how you check out? Do you use --reference or --shared?

 
Ann

Like I said in the opening post, we’re using Atlassian Bamboo as our CI system.

We did not see this issue with:

  • SonarQube server 9.3.0
  • SonarScanner 4.7.0.2747

A permanent solution would be nice, but I mainly opened this Topic to share our workaround in case other users run into the same problem.

The git clones are made using a Bamboo internal plugin where there are very limited options on how the clone is made.

The only options are:

And we select as much as possible the options that limit the clone.

1 Like