Error in SonarLint for IntelliJ


  • Java: JetBrains s.r.o. 17.0.6
  • OS: Mac OS X x86_64
  • IDE: PyCharm 2023.1.2
  • SonarLint:
java.lang.StringIndexOutOfBoundsException: begin 4189, end 4194, length 8
	at java.base/java.lang.String.checkBoundsBeginEnd(
	at java.base/java.lang.String.substring(
	at java.base/java.lang.String.subSequence(
	at c.ij.psi.impl.source.tree.injected.DocumentWindowImpl.prepareReplaceString(
	at c.ij.psi.impl.source.tree.injected.DocumentWindowImpl.replaceString(
	at c.ij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$invokeIntention$8(
	at c.ij.oa.application.WriteAction.lambda$run$1(
	at c.ij.oa.application.impl.ApplicationImpl.runWriteActionWithClass(
	at c.ij.oa.application.impl.ApplicationImpl.runWriteAction(
	at c.ij.codeInsight.intention.impl.ShowIntentionActionsHandler.invokeIntention(
	at c.ij.codeInsight.intention.impl.ShowIntentionActionsHandler.lambda$chooseActionAndInvoke$7(
	at c.ij.oa.command.impl.CoreCommandProcessor.executeCommand(
	at c.ij.oa.command.impl.CoreCommandProcessor.executeCommand(
	at c.ij.oa.command.impl.CoreCommandProcessor.executeCommand(

Hi @Robert_Malai, thank you for your report!

We had a similar case reported by another user recently, it seems you tried to apply a quick fix. Do you have more information on how this error happened? Are you able to reproduce it?

The one thing that stands out is the fact that I was using some docker containers from my pytest suite.
Nothing else out of the ordinary.


Hi @Robert_Malai,

Sorry for the late response. I was not able to reproduce, was it a one-off or do you reproduce the problem consistently?

I saw some possible improvements to make in the code to make it more robust so I created this ticket. I just pushed a fix so it should be available at the next release at the end of the month.

Thanks for reporting here!