Unable to find rule definition for rule pythonsecurity:S5334

Hello Everyone,
Thanks for taking the time to take a look at my problem. I’m having some difficulty troubleshooting this issue (or maybe it is expected behavior and I’m too ignorant to realize it). These examples are contrived in order to convey the nature of the problem so please don’t ask me why I need to use SonarLint to tell me that there’s unreachable code after a return statement in one of my functions. Anyways, here is what’s going on.

  • Operating system: Windows 10
  • IDE name and flavor/env: VSCode 1.57.1
  • SonarLint plugin version: 3.3.3
  • Is connected mode used: Yes
    • Connected to SonarCloud or SonarQube (and which version): SonarQube 9.1.0.47736

And a thorough description of the problem / question:

I’m unable to load the rule description for the above mentioned issue in vscode, and instead have to open the taint vulnerability in my web browser. This is a contrived example, but I similarly have this issue with pythonsecurity:s5145 in another project. I have declared my java install in the following way in my user settings

    "sonarlint.ls.javaHome": "C:\\Program Files\\Java\\jdk-11.0.9"

I see this in my logs when vscode starts.

[Debug - 11:37:48.208] Rule pythonsecurity:S5334 is enabled on the server, but not available in SonarLint

And get this error in my SonarLint output when I try to open the description
image

[stderr] Mar 30, 2022 11:42:51 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError

[stderr] SEVERE: Internal error: java.lang.IllegalStateException: Unable to find rule definition for rule pythonsecurity:S5334

[stderr] java.util.concurrent.CompletionException: java.lang.IllegalStateException: Unable to find rule definition for rule pythonsecurity:S5334

[stderr]    at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)

[stderr]    at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)

[stderr]    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:645)

[stderr]    at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)

[stderr]    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)

[stderr]    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)

[stderr]    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)

[stderr]    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)

[stderr]    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

[stderr] Caused by: java.lang.IllegalStateException: Unable to find rule definition for rule pythonsecurity:S5334

[stderr]    at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.getActiveRuleDetails(ConnectedSonarLintEngineImpl.java:383)

[stderr]    at org.sonarsource.sonarlint.ls.CommandManager.openRuleDescription(CommandManager.java:227)

[stderr]    at org.sonarsource.sonarlint.ls.CommandManager.handleOpenRuleDescriptionFromCodeActionCommand(CommandManager.java:281)

[stderr]    at org.sonarsource.sonarlint.ls.CommandManager.executeCommand(CommandManager.java:259)

[stderr]    at org.sonarsource.sonarlint.ls.SonarLintLanguageServer.lambda$executeCommand$5(SonarLintLanguageServer.java:322)

[stderr]    at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)

[stderr]    ... 6 more

[Trace - 11:42:51 AM] Received response 'workspace/executeCommand - (5)' in 26ms. Request failed: Internal error. (-32603).

Error data: "java.util.concurrent.CompletionException: java.lang.IllegalStateException: Unable to find rule definition for rule pythonsecurity:S5334\r\n\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)\r\n\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)\r\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:645)\r\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)\r\n\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)\r\n\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)\r\n\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)\r\n\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)\r\n\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)\r\nCaused by: java.lang.IllegalStateException: Unable to find rule definition for rule pythonsecurity:S5334\r\n\tat org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.getActiveRuleDetails(ConnectedSonarLintEngineImpl.java:383)\r\n\tat org.sonarsource.sonarlint.ls.CommandManager.openRuleDescription(CommandManager.java:227)\r\n\tat org.sonarsource.sonarlint.ls.CommandManager.handleOpenRuleDescriptionFromCodeActionCommand(CommandManager.java:281)\r\n\tat org.sonarsource.sonarlint.ls.CommandManager.executeCommand(CommandManager.java:259)\r\n\tat org.sonarsource.sonarlint.ls.SonarLintLanguageServer.lambda$executeCommand$5(SonarLintLanguageServer.java:322)\r\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)\r\n\t... 6 more\r\n"

I think this


may be at the heart of the issue (SonarQube Taint Analyzer vs sonarlint) but the connected mode docs state that I should

get all of the context in your IDE that you need to triage and fix security problems and make sure the code you commit is safe.

So you can see where the confusion arises. Anyways, thanks again for taking the time and I’m looking forward to hearing back from y’all

1 Like

Hello @lucash,

Welcome to the community!

There is indeed a problem when trying to display a taint vulnerability description. I created this ticket to take care of it. I don’t have an ETA for the moment. I don’t think there is a workaround apart from looking at the description in the browser as you did.

Thanks for reporting

1 Like

Thanks for getting back to me. Is there a similar ticket for Pycharm? Same issue there as well

You’re right, the problem also appears on PyCharm and other IntelliJ IDEs, here is the ticket.

2 Likes