For some files the Analysis is failed

If your question is about SonarLint in the IntelliJ Platform, VS Code, Visual Studio, or Eclipse, please post it in that sub-category.

Otherwise, please provide:

  • Operating system: Windows 10
  • IDE name and flavor/env: VS Code 1.82.3, SonarLint 3.21.0

And a thorough description of the problem / question:

  • For some files I have the following error (even if I make the file blank or rename it).
  • I believe there are some encoding problems because I open/save this file in both Windows and Mac.
  • For other files I have no issues.
  • It’s a React/TypeScript project.
  • For some files, when I add an empty line on top, it fixes the issue but not always. :man_shrugging:
    Please help, thanks.
[Error - 10:23:26.566] Analysis failed
java.lang.NullPointerException: Cannot invoke "java.lang.Integer.intValue()" because "startLine" is null
	at org.sonarsource.sonarlint.ls.connected.ServerIssueTrackerWrapper.lambda$toIssueTrackables$6(ServerIssueTrackerWrapper.java:198)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
	at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
	at org.sonarsource.sonarlint.ls.connected.ServerIssueTrackerWrapper.toIssueTrackables(ServerIssueTrackerWrapper.java:204)
	at org.sonarsource.sonarlint.ls.connected.ServerIssueTrackerWrapper.matchAndTrack(ServerIssueTrackerWrapper.java:100)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.lambda$analyzeConnected$30(AnalysisTaskExecutor.java:518)
	at java.base/java.util.HashMap.forEach(Unknown Source)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.lambda$analyzeConnected$31(AnalysisTaskExecutor.java:515)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyzeWithTiming(AnalysisTaskExecutor.java:548)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyzeConnected(AnalysisTaskExecutor.java:513)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.lambda$analyzeSingleModuleNonExcluded$20(AnalysisTaskExecutor.java:353)
	at java.base/java.util.Optional.map(Unknown Source)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyzeSingleModuleNonExcluded(AnalysisTaskExecutor.java:353)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyzeSingleModule(AnalysisTaskExecutor.java:308)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:226)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:191)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.lambda$analyze$2(AnalysisTaskExecutor.java:159)
	at java.base/java.util.HashMap.forEach(Unknown Source)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.analyze(AnalysisTaskExecutor.java:159)
	at org.sonarsource.sonarlint.ls.AnalysisTaskExecutor.run(AnalysisTaskExecutor.java:131)
	at org.sonarsource.sonarlint.ls.AnalysisScheduler.lambda$analyzeAsync$1(AnalysisScheduler.java:239)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

Hello, welcome to the community! And thanks for reporting this.

This looks very similar to a bug we fixed in the current development cycle, the fix should ship with version 3.22 (scheduled for next week).

1 Like

The bug is fixed now after version 3.22

3 Likes

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