7

I'm currently working in my Job with Eclipse and Java. We should use SonarLint to get some cleaner code and 'till yesterday everything was fine. But yesterday morning, when I opened Eclipse, SonarLint throw me the following errormessage.

I've already searched in Google, deleted the .sonarlint folder, also the settingsfolder of eclipse and the .sonarlint folder inside the eclipse-workspace. Everyone of them where recreated by restarting eclipse but nothing helped here. I'm still getting the error:

Starting SonarLint for Eclipse 4.2.0.201909192007
SonarLint processing file /rap-server-core/src/main/java/com/rapidclipse/framework/server/ui/filter/FilterComponent.java...
Starting standalone SonarLint engine 4.2.0.201909192007...
Found 17 issue(s)
Error during execution of SonarLint analysis
java.lang.IllegalStateException: Failed to read local issue store index
    at org.sonarlint.eclipse.core.internal.tracking.StringStoreIndex.load(StringStoreIndex.java:55)
    at org.sonarlint.eclipse.core.internal.tracking.StringStoreIndex.keys(StringStoreIndex.java:45)
    at org.sonarlint.eclipse.core.internal.tracking.IndexedObjectStore.deleteInvalid(IndexedObjectStore.java:78)
    at org.sonarlint.eclipse.core.internal.tracking.IssueStore.<init>(IssueStore.java:62)
    at org.sonarlint.eclipse.core.internal.SonarLintCorePlugin.lambda$0(SonarLintCorePlugin.java:102)
    at org.sonarlint.eclipse.core.internal.tracking.IssueTrackerRegistry.newTracker(IssueTrackerRegistry.java:54)
    at org.sonarlint.eclipse.core.internal.tracking.IssueTrackerRegistry.getOrCreate(IssueTrackerRegistry.java:43)
    at org.sonarlint.eclipse.core.internal.SonarLintCorePlugin.getOrCreateIssueTracker(SonarLintCorePlugin.java:146)
    at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.trackIssues(AbstractAnalyzeProjectJob.java:317)
    at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.lambda$15(AbstractAnalyzeProjectJob.java:302)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2295)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317)
    at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.updateMarkers(AbstractAnalyzeProjectJob.java:302)
    at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.runAnalysisAndUpdateMarkers(AbstractAnalyzeProjectJob.java:209)
    at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.doRun(AbstractAnalyzeProjectJob.java:169)
    at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarProjectJob.run(AbstractSonarProjectJob.java:45)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
    at com.google.protobuf.InvalidProtocolBufferException.invalidTag(InvalidProtocolBufferException.java:102)
    at com.google.protobuf.CodedInputStream$StreamDecoder.readTag(CodedInputStream.java:2066)
    at org.sonarlint.eclipse.core.internal.proto.Sonarlint$StorageIndex.<init>(Sonarlint.java:2496)
    at org.sonarlint.eclipse.core.internal.proto.Sonarlint$StorageIndex.<init>(Sonarlint.java:2482)
    at org.sonarlint.eclipse.core.internal.proto.Sonarlint$StorageIndex$1.parsePartialFrom(Sonarlint.java:3126)
    at org.sonarlint.eclipse.core.internal.proto.Sonarlint$StorageIndex$1.parsePartialFrom(Sonarlint.java:1)
    at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:215)
    at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:232)
    at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:237)
    at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:48)
    at com.google.protobuf.GeneratedMessageV3.parseWithIOException(GeneratedMessageV3.java:332)
    at org.sonarlint.eclipse.core.internal.proto.Sonarlint$StorageIndex.parseFrom(Sonarlint.java:2746)
    at org.sonarlint.eclipse.core.internal.tracking.StringStoreIndex.load(StringStoreIndex.java:53)
    ... 16 more

I don't know what the problem is and as I said google couldn't help me that much (maybe I'm just to stupid for google idk)

lczapski
  • 4,026
  • 3
  • 16
  • 32
Daniel
  • 83
  • 1
  • 5
  • try to delete the directory /sonarlint/issuestore/. In intellij it is at the location [project_directory]/.idea/sonarlint/issuestore/. Check the same for eclipse – Sahit Nov 07 '19 at 10:58
  • Thanks for the hint but I can't find such a folder within my eclipse directory nor in any other sonarlint folder... – Daniel Nov 07 '19 at 11:55

3 Answers3

7

I had the same problem.

I had tried downgrading from 5.0 to 4.3, but that did not solve the issue.

So I did some investigation and found that in the source code sonarlint-eclipse/org.sonarlint.eclipse.core/src/org/sonarlint/eclipse/core/internal/tracking/StringStoreIndex.java line 53 ultimately lead to public static final String INDEX_FILENAME = "index.pb"; (line 34).

So what I did was del /s /q /f index.pb within the Eclipse, Maven and Workspace folders. And it was under the Workspace .metadata\.plugins folder.

And now, the error seems to be gone. SonarLint is finally reporting on where the "smelly" code is again.

I have a feeling that the permissions for index.pb got messed-up or not updated, and could not load the file as the error message suggested.

But back to normal now. :)

Zaxxon
  • 182
  • 1
  • 4
  • 18
  • 2
    Sadly it didn't work for me. I removed my existing Sonar binding, uninstalled sonar plugin and reinstalled the latest version, and tried your command. It did remove a couple of index.pb files in .plugins\org.eclipse.core.resources\.projects\NameOfMyProjects but I still have an error. Error during execution of SonarLint analysis java.lang.IllegalStateException: Failed to read issues at org.sonarlint.eclipse.core.internal.tracking.IssueStore.lambda$0(IssueStore.java:51... – WorkInProgress Mar 05 '20 at 14:48
  • Fair. Although, "Failed to read issues at org.sonarlint.eclipse.core.internal.tracking.IssueStore.lambda$0(IssueStore.java:51" sounds a bit different. Did you remove the files while Eclipse was open or closed? – Zaxxon Mar 05 '20 at 18:15
  • Eclipse was probably close. I had the same error message, this new one came after deleting index.pb files. Well it was worth a shot ;) – WorkInProgress Mar 10 '20 at 09:47
  • 1
    This question and answer is eclipse related but it helped me to workaround the problem in intellij: `$ find . -name "index.pb" -print` resulted in `./.idea/sonarlint/issuestore/index.pb` which I deleted and it started to work again – Lasneyx Apr 03 '20 at 10:59
  • `del /s /q /f index.pb` in in eclipse workspace worked for me – Arfat Binkileb Mar 30 '22 at 08:27
0

I've just reinstalled Eclipse... now everything works fine again. I still don't know what problem caus' this error, but now that it's gone I just hope it'll never come back :D

For the reinstalling I've only deleted every folder, who has something to do with eclipse. Except, of course, my workspace folder^^

Daniel
  • 83
  • 1
  • 5
0

Update the Sonarlint installed in the IDE.

Steps in Eclipse and STS IDE:

Select Help, then "Eclipse Marketplace", search for SonarLint, click on the Installed Icon, finally select "Update".

Dimitrios Mistriotis
  • 2,626
  • 3
  • 28
  • 45