I've had a bug reported by a couple of users where their IntelliJ instance will more or less lock up and require a restart. I've finally managed to reproduce part of it, which is the following exception. I tend to either suddenly get it 50 times or so, or it will happen repeatedly until I restart IntelliJ. I've looked at the code which throws it, and I'm not sure what's going on - it looks like some invariant is violated related to committing, something along the lines of that the previously committed text of the document is not equal to the text of the previous PSI tree, or something. Can anyone shed any light on what might cause this?

[22075917]  ERROR - .psi.impl.DocumentCommitThread -  
com.intellij.util.IncorrectOperationException: SingleRootFileViewProvider{myVirtualFile=file:///Users/colin/dev/cursive-bugs/cursive-1382/src/cursive_1382/foo.clj, content=com.intellij.psi.SingleRootFileViewProvider$PsiFileContent@4964e280}
    at com.intellij.psi.impl.source.text.BlockSupportImpl.makeFullParse(
    at com.intellij.psi.impl.source.text.BlockSupportImpl.reparseRange(
    at com.intellij.psi.impl.DocumentCommitThread.doCommit(
    at com.intellij.psi.impl.DocumentCommitThread$
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(
    at com.intellij.psi.impl.DocumentCommitThread.commitUnderProgress(
    at com.intellij.psi.impl.DocumentCommitThread.access$400(
    at com.intellij.psi.impl.DocumentCommitThread$
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(
    at com.intellij.psi.impl.DocumentCommitThread.pollQueue(
    at com.intellij.util.concurrency.BoundedTaskExecutor.runFirstTaskThenPollAndRunRest(
    at com.intellij.util.concurrency.BoundedTaskExecutor.access$000(
    at com.intellij.util.concurrency.BoundedTaskExecutor$
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$


not sure about what causes it however these methods may help:


Hi Colin,

we've seen such exceptions reported, but they remain a mystery so far. They indeed indicate that PSI text isn't equal to the one recorded as previously committed, but I don't yet know what can cause it. Either a PSI modification that went unnoticed by our framework for some reason, or a similar document modification. Or getText overridden in a faulty way.

Can you reproduce this reliably? If yes, we could think of a way to debug this.


Hi Peter, I believe I can reproduce it semi-reliably at least. I'll contact you directly to think about debugging this.


I am also experimenting such a problem in one plugin I am developing. Could you please share how you solved it?


Sergio, the OPs issue was caused by an NPE thrown from their custom tree change preprocessor right inside commitDocument. Since then, we've added some recovery from that situation, so you should also get some other exceptions. Or, it might be that you're having some completely different issue.


thanks for your answer Peter, I created a separate thread for that here:

Unfortunately, all the newlines were removed (I did not expect that to happen) so the messages I wrote after the code snippets are difficult to read.


Please sign in to leave a comment.