ClassNotFoundException for PsiTreeUtilKt in WebStorm

I'm getting a `ClassNotFoundException` for com.intellij.psi.util.PsiTreeUtilKt when invoking an intention action in my plugin on WebStorm (WS-173.4127.31).

There are a couple of weird things about this:

  1. The same plugin JAR runs without an exception on IntelliJ community edition (#IC-173.3727.127).
  2. The file that is apparently trying to load PsiTreeUtilKt does not use PsiTreeUtil anywhere (although it does use an inline extension function on PsiElement which uses PsiTreeUtil in its body)
  3. The stack trace for the ClassNotFoundException references the last line of the file (ElmImportIntentionAction.kt has 297 lines total)

See stack trace below.

More info about my plugin setup:

  • using IDEA Ultimate (#IU-173.4127.27) for plugin development
  • my IntelliJ plugin SDK is based on CE (#IC-173.3727.127)
  • JDK: 1.8.0-152
  • macOS 10.13.2


The stack trace:

java.lang.NoClassDefFoundError: com/intellij/psi/util/PsiTreeUtilKt
at org.elm.ide.intentions.ElmImportIntentionAction.findApplicableContext(ElmImportIntentionAction.kt:298)
at org.elm.ide.intentions.ElmImportIntentionAction.findApplicableContext(ElmImportIntentionAction.kt:44)
at org.elm.ide.intentions.ElmAtCaretIntentionActionBase.isAvailable(ElmAtCaretIntentionActionBase.kt:52)
at com.intellij.codeInsight.intention.BaseElementAtCaretIntentionAction.isAvailable(
at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(
at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(
at java.util.ArrayList.forEach(
at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getAvailableFixes(
at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.getActionsToShow(
at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.a(
at com.intellij.codeInsight.daemon.impl.ShowIntentionsPass.doCollectInformation(
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.a(
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.c(
at com.intellij.openapi.progress.impl.CoreProgressManager.a(
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.d(
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.b(
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(
at com.intellij.codeInsight.daemon.impl.PassExecutorService$
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(
at java.util.concurrent.ForkJoinTask.doExec(
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(
at java.util.concurrent.ForkJoinPool.runWorker(
Caused by: java.lang.ClassNotFoundException: com.intellij.psi.util.PsiTreeUtilKt PluginClassLoader[org.elm.klazuka, 0.9.1]
at java.lang.ClassLoader.loadClass(
... 28 more




When I package my plugin for development, it generates a JAR that just contains my project's class files--there are no JARs bundled with it. I'm new to IntelliJ plugin development so maybe I'm missing something simple. Are there any plugin support JARs that I need to bundle?



unfortunately, PsiTreeUtilKt resides in the java-impl module which is available only in IDEs with Java support (IntelliJ Community and Ultimate). While we can consider moving these extension methods to the platform core, it won't happen until 2018.1 which means that if you want your plugin compatible with 2017.3 you'll have to use plain PsiTreeUtil methods


Yep, that was it. Thanks! I had my own `parentOfType` inline Kotlin function but was accidentally importing the one from java-impl.

Is there a way for me to run my tests against products like WebStorm?


Yes, you can set it up as a Platform SDK just like you did with IntelliJ


Hi, any progress with moving this into platform core? I got the same error due to autocompletion while plugin development. Unfortunately, I've noticed the exception after my plugin has been released.


Roman, it was moved to platform-lang.impl in 2019.2, see aeb88acd3cc7b277e353c0433f7274d3a1914e1a