NPE opening diff view with LightVirtualFile

Hi all,

I’ve the following exception when I open a DiffViewer using lightweight file:

2025-09-27 13:45:53,440 [ 260140] SEVERE - #c.i.c.d.i.PassExecutorService - getOriginalFile(...) must not be null
java.lang.NullPointerException: getOriginalFile(...) must not be null
	at org.jetbrains.kotlin.idea.util.FileUtils.getOriginalOrDelegateFile(FileUtils.kt:34)
	at org.jetbrains.kotlin.idea.fir.extensions.KtCompilerPluginsProviderIdeImpl.getRegisteredExtensions(KtCompilerPluginsProviderIdeImpl.kt:155)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.projectStructure.SessionFactoryHelpersKt.registerCompilerPluginExtensions(sessionFactoryHelpers.kt:97)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirAbstractSessionFactory.createScriptSession(LLFirAbstractSessionFactory.kt:161)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionCache.createSession(LLFirSessionCache.kt:128)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionCache.access$createSession(LLFirSessionCache.kt:28)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionCache$getSession$1.invoke(LLFirSessionCache.kt:60)
	at org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionCache$getSession$1.invoke(LLFirSessionCache.kt:60)

The file is created in this way:

LightVirtualFile(
                file.url,
                file.fileType,
                String(file.contentsToByteArray(), file.charset),
                file.charset,
                file.modificationStamp,
            )

Not sure how to pass the originalFile to a LightVirtualFile (I assumed should be used when a virtual file is not available.

Any suggestion?

Thanks a lot in advance.

Intellij version I found it:

IntelliJ IDEA 2025.2 (Community Edition)
Build #IC-252.23892.409, built on August 1, 2025
Source revision: 0a9a69b3f9332
Runtime version: 21.0.7+6-b1038.58 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.wl.WLToolkit
Linux 6.16.8-200.fc42.x86_64
Fedora Linux 42 (KDE Plasma Desktop Edition); glibc: 2.41
Kotlin analyzer version: 2.2.20-dev-5812
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 2048M
Cores: 16
Registry:
ide.experimental.ui=true
llm.show.ai.promotion.window.on.start=false
Non-Bundled Plugins:
com.gitlab.msciachero.intellij-gitlab-plugin (13.1.0-SNAPSHOT+002)
Kotlin: 252.23892.409-IJ
Current Desktop: KDE

Hello @m.sciachero. The problem is on the IntelliJ side, and was fixed in 252.26199 and later builds

1 Like

Thanks a lot, in any case I switch back to my custom implementation of Virtual File (as mirror of remote repository), but good to know that I can move back to LightVirtualFile if I have trouble with my implementation.