Error in SonarLint for IntelliJ

Environment:

  • Java: JetBrains s.r.o. 17.0.10
  • OS: Windows 11 amd64
  • IDE: IntelliJ IDEA 2024.1
  • SonarLint: 10.5.0.78339
java.lang.Throwable: Write-unsafe context! Model changes are allowed from write-safe contexts only. Please ensure you're using invokeLater/invokeAndWait with a correct modality state (not "any"). See TransactionGuard documentation for details.
  current modality=ModalityState:{[SonarLint Analysis 111926589: running=true; canceled=false]}
	at c.ij.oa.diagnostic.Logger.error(Logger.java:376)
	at c.ij.oa.application.TransactionGuardImpl.assertWriteActionAllowed(TransactionGuardImpl.java:136)
	at c.ij.psi.impl.PsiModificationTrackerImpl.fireEvent(PsiModificationTrackerImpl.java:81)
	at c.ij.psi.impl.PsiModificationTrackerImpl.incCountersInner(PsiModificationTrackerImpl.java:87)
	at c.ij.psi.impl.PsiModificationTrackerImpl.treeChanged(PsiModificationTrackerImpl.java:97)
	at c.ij.psi.impl.PsiManagerImpl.fireEvent(PsiManagerImpl.java:346)
	at c.ij.psi.impl.PsiManagerImpl.propertyChanged(PsiManagerImpl.java:320)
	at c.ij.psi.impl.file.impl.FileManagerImpl.firePropertyChangedForUnloadedPsi(FileManagerImpl.java:166)
	at c.ij.oa.application.impl.RwLockHolder.runWriteAction(RwLockHolder.kt:344)
	at c.ij.oa.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:883)
	at c.ij.psi.impl.PsiManagerImpl.dropPsiCaches(PsiManagerImpl.java:93)
	at c.ij.psi.stubs.StubIndexEx.lambda$tryFixIndexesForProblemFiles$9(StubIndexEx.java:281)
	at c.ij.oa.application.WriteAction.lambda$run$1(WriteAction.java:85)
	at c.ij.oa.application.impl.RwLockHolder.runWriteAction(RwLockHolder.kt:364)

Hello @Gallo_Alitalia, thank you for your report!

Could you please share the full stack trace with us if you still have it or if it ever happens again?

In the meantime, I created this bug ticket on our side, and we will investigate it.