GIT_FILES_BLAME intermittently fails with MissingObjectException: Missing blob on a full local clone

Environment

  • SonarScanner CLI 8.1.0.6389, engine sonarcloud-scanner-engine-12.28.0.3105
  • Bundled JGit 7.4.0.202509020913-r
  • macOS 26.5.2 (arm64), OpenJDK 26.0.2, git 2.50.1
  • SonarQube Cloud, running on a local dev machine (not CI)

What happened

One analysis aborted during the SCM step. The next run of the exact same command, on the exact same commit, succeeded.

INFO  SCM Publisher SCM provider for this project is: git
INFO  SCM Publisher 193 source files to be analyzed
INFO  SCM Publisher 0/193 source files have been analyzed (done) | time=78ms
ERROR Error during SonarScanner Engine execution
java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: org.eclipse.jgit.errors.MissingObjectException: Missing blob 469784398b2b85ed61517ea852443b1ad1337008
	at org.sonar.scm.git.blame.FileBlamer.waitForTasks(FileBlamer.java:317)
	at org.sonar.scm.git.blame.FileBlamer.blameWithFileDiffs(FileBlamer.java:290)
	at org.sonar.scm.git.blame.FileBlamer.blameParent(FileBlamer.java:132)
	at org.sonar.scm.git.blame.BlameGenerator.process(BlameGenerator.java:168)
	at org.sonar.scm.git.blame.BlameGenerator.generateBlame(BlameGenerator.java:152)
	at org.sonar.scm.git.blame.RepositoryBlameCommand.call(RepositoryBlameCommand.java:149)
	at org.sonar.scm.git.CompositeBlameCommand.blameWithFilesGitCommand(CompositeBlameCommand.java:204)
	at org.sonar.scm.git.CompositeBlameCommand.blame(CompositeBlameCommand.java:101)
	at org.sonar.scanner.scm.ScmPublisher.execute(ScmPublisher.java:102)
	...
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing blob 469784398b2b85ed61517ea852443b1ad1337008
	at org.eclipse.jgit.internal.storage.file.WindowCursor.open(WindowCursor.java:154)
	at org.sonar.scm.git.blame.BlobReader.loadText(BlobReader.java:133)
	at org.sonar.scm.git.blame.BlobReader.loadText(BlobReader.java:73)
	at org.sonar.scm.git.blame.FileBlamer.splitBlameWithParent(FileBlamer.java:344)
	at org.sonar.scm.git.blame.FileBlamer.lambda$blameWithFileDiffs$1(FileBlamer.java:279)

The blob is not actually missing

  • git cat-file -t 469784398b2b85ed61517ea852443b1ad1337008blob
  • git verify-pack -v finds it in pack-3cf2b0fe... (43-byte blob, first introduced in a commit from Aug 2025)
  • git fsck → clean, dangling objects only
  • git multi-pack-index verify → clean
  • Full clone: core.repositoryformatversion=0, no remote.origin.partialclonefilter, no
    objects/info/alternates, no .git/shallow

So this is not the blobless/shallow-clone case discussed in Missing blob jgit error with SonarCloud.
Nothing wrote to .git/objects during the analysis either (verified by mtime).

I could not reproduce it on demand

I replayed the same code path outside the scanner, against the same repository and commit, driving the engine jar directly with the same settings CompositeBlameCommand uses:

new RepositoryBlameCommand(repo)
    .setTextComparator(RawTextComparator.WS_IGNORE_ALL)
    .setMultithreading(true)
    .setFilePaths(paths)   // every path in HEAD, 382 files
    .call();

31 out of 31 runs succeeded, including under -Xmx96m and -Xmx48m.

I also checked the bundled FileBlamer: splitBlameWithParent does call
objectReader.newReader() before each BlobReader.loadText, so this does not look like a plain shared-ObjectReader race.

Possibly relevant repository state

Roughly 8,900 objects across 3 packs, plus .git/objects/pack/multi-pack-index and a split commit-graph in .git/objects/info/commit-graphs. I cannot link either to the failure, but JGit 7.x does read multi-pack-index files, so it may be worth ruling out.

Workaround

sonar.scm.use.blame.algorithm=GIT_NATIVE_BLAME

With that set, the same analysis blames 194/194 files in 845 ms and reports EXECUTION SUCCESS.