java.lang.IllegalStateException: Failed to find all committed files

Must-share information (formatted with Markdown):

  • SonnarScanner CLI - sonar-scanner-cli-4.7.0.2747-linux.zip

This is happening on multiple projects since a few hours ago. We are seeing this on our CI systems:

15:39:39   ERROR: Error during SonarScanner execution
15:39:39   INFO: Final Memory: 38M/134M
15:39:39   java.lang.IllegalStateException: Failed to find all committed files
15:39:39   INFO: ------------------------------------------------------------------------
15:39:39     at org.sonar.scm.git.CompositeBlameCommand.collectAllCommittedFiles(CompositeBlameCommand.java:114)
15:39:39     at org.sonar.scm.git.CompositeBlameCommand.blame(CompositeBlameCommand.java:72)
15:39:39     at org.sonar.scanner.scm.ScmPublisher.publish(ScmPublisher.java:84)
15:39:39     at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:362)
15:39:39     at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
15:39:39     at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
15:39:39     at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:135)
15:39:39     at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
15:39:39     at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
15:39:39     at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
15:39:39     at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
15:39:39     at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
15:39:39     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:39:39     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
15:39:39     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
15:39:39     at java.base/java.lang.reflect.Method.invoke(Unknown Source)
15:39:39     at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
15:39:39     at com.sun.proxy.$Proxy0.execute(Unknown Source)
15:39:39     at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
15:39:39     at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
15:39:39     at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
15:39:39     at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
15:39:39     at org.sonarsource.scanner.cli.Main.main(Main.java:61)
15:39:39   Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 4c78c69da8b74c0d2b955f0e4b2e6c3e5a5353a6
15:39:39     at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:135)
15:39:39     at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:214)
15:39:39     at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:1075)
15:39:39     at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:985)
15:39:39     at org.sonar.scm.git.CompositeBlameCommand.collectAllCommittedFiles(CompositeBlameCommand.java:101)
15:39:39     ... 22 more

I had a look at

15:39:39 Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing unknown 4c78c69da8b74c0d2b955f0e4b2e6c3e5a5353a6

That is a merge commit and it does exist.

Hello @alin_g ,

How do you check out your branch before executing Sonar analysis? What is the version of SonarQube you using?

Hello Jacek,

Thank you for looking into this. We recently upgraded to 9.5.
The checkout is handled by TeamCity and this is what it seems to be doing:

 [Update git mirror (/root/agent/system/git/git-0E23E9D8.git)] /usr/bin/git init --bare --initial-branch=main
[10:58:28] :			 [Update git mirror (/root/agent/system/git/git-0E23E9D8.git)] /usr/bin/git config http.sslCAInfo
[10:58:28] :			 [Update git mirror (/root/agent/system/git/git-0E23E9D8.git)] Forced fetch (teamcity.git.fetchAllHeads=true) with +refs/heads/*:refs/heads/* refspec
[10:58:28] :			 [Update git mirror (/root/agent/system/git/git-0E23E9D8.git)] /usr/bin/git -c credential.helper= fetch --progress --recurse-submodules=no origin +refs/heads/*:refs/heads/* (1s)
....
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] The .git directory is missing in '/root/agent/work/a00796389cbd5412'. Running 'git init'...
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git init --initial-branch=main
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git config lfs.storage /root/agent/system/git/git-0E23E9D8.git/lfs
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git config core.sparseCheckout true
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git config http.sslCAInfo
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git show-ref
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git -c credential.helper= ls-remote origin
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] Forced fetch (teamcity.git.fetchAllHeads=true) with +refs/heads/*:refs/remotes/origin/* refspec
[10:58:29] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git -c credential.helper= fetch --progress --recurse-submodules=no origin +refs/heads/*:refs/remotes/origin/*
[10:58:30] :				 [/usr/bin/git -c credential.helper= fetch --progress --recurse-submodules=no origin +refs/heads/*:refs/remotes/origin/*] 
[10:58:30] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git log -n1 --pretty=format:%H%x20%s 430efd8738a1ebcce05f1d34bcbe7756f230f68e --
[10:58:30] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git branch
[10:58:30] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git update-ref refs/heads/FVCL-105 430efd8738a1ebcce05f1d34bcbe7756f230f68e
[10:58:30] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git -c credential.helper= checkout -q -f FVCL-105
[10:58:30] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git branch --set-upstream-to=refs/remotes/origin/FVCL-105
[10:58:30] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] Cleaning fvcl-frontend (2) in /root/agent/work/a00796389cbd5412 the file set ALL_UNTRACKED
[10:58:30] :			 [Update checkout directory (/root/agent/work/a00796389cbd5412)] /usr/bin/git clean -f -d -x

These are some of the debug messages before the failure, in case it helps:

[10:59:01] :	 [Step 1/1] 07:59:01.561 INFO: Load project repositories (done) | time=21ms
[10:59:01] :	 [Step 1/1] 07:59:01.562 INFO: SCM collecting changed files in the branch
[10:59:01] :	 [Step 1/1] 07:59:01.593 DEBUG: loading config FileBasedConfig[/root/.config/jgit/config]
[10:59:01] :	 [Step 1/1] 07:59:01.594 DEBUG: readpipe [/usr/bin/git, --version],/usr/bin
[10:59:01] :	 [Step 1/1] 07:59:01.603 DEBUG: readpipe may return 'git version 2.30.2'
[10:59:01] :	 [Step 1/1] 07:59:01.603 DEBUG: remaining output:
[10:59:01] :	 [Step 1/1] 
[10:59:01] :	 [Step 1/1] 07:59:01.603 DEBUG: readpipe [/usr/bin/git, config, --system, --show-origin, --list, -z],/usr/bin
[10:59:01] :	 [Step 1/1] 07:59:01.605 DEBUG: readpipe may return 'null'
[10:59:01] :	 [Step 1/1] 07:59:01.606 DEBUG: remaining output:
[10:59:01] :	 [Step 1/1] 
[10:59:01] :	 [Step 1/1] 07:59:01.624 DEBUG: readpipe rc=128
[10:59:01] :	 [Step 1/1] 07:59:01.624 DEBUG: Exception caught during execution of command '[/usr/bin/git, config, --system, --show-origin, --list, -z]' in '/usr/bin', return code '128', error message 'fatal: unable to read config file '/etc/gitconfig': No such file or directory
[10:59:01] :	 [Step 1/1] '
[10:59:01] :	 [Step 1/1] 07:59:01.625 DEBUG: loading config FileBasedConfig[/root/.gitconfig]
[10:59:01] :	 [Step 1/1] 07:59:01.658 DEBUG: Thread[JGit-FileStoreAttributeReader-1,5,main]: start measure timestamp resolution / (overlay) in /app/.git
[10:59:01] :	 [Step 1/1] 07:59:01.660 DEBUG: Thread[JGit-FileStoreAttributeReader-1,5,main]: end measure timestamp resolution / (overlay) in /app/.git; got PT0.000144S
[10:59:01] :	 [Step 1/1] 07:59:01.660 DEBUG: Thread[JGit-FileStoreAttributeReader-1,5,main]: start measure minimal racy interval in /app/.git
[10:59:01] :	 [Step 1/1] 07:59:01.758 DEBUG: Thread[main,5,main]: use fallback timestamp resolution for directory /app/.git
[10:59:01] :	 [Step 1/1] 07:59:01.761 DEBUG: Thread[main,5,main]: cannot measure timestamp resolution of unborn directory /root/agent/system/git/git-0E23E9D8.git
[10:59:01] :	 [Step 1/1] 07:59:01.761 DEBUG: Thread[main,5,main]: cannot measure timestamp resolution of unborn directory /root/agent/system/git/git-0E23E9D8.git/objects
[10:59:01] :	 [Step 1/1] 07:59:01.768 WARN: Missing unknown 1782328a254865b1361ffd499967730484d5d3b4

Please also note that we’re performing the scan inside a docker container (using FROM node:latest).
Edit: Same issue appears with FROM mcr.microsoft.com/dotnet/sdk:6.0 and then apt -qq install default-jre & dotnet tool install --global dotnet-sonarscanner
Any help is much appreciated.

For anyone else running into this with TeamCity, this is what has fixed it:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.