IndexNotReadyException in REPL
Having just made many changes to the project in the file system (git checkout -- someDirectory) and then switching quickly back to IntelliJ and trying to run a command at the REPL (Load file in REPL) I received the following response instead:
Error evaluating - class com.intellij.openapi.project.IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
This message appeared in the REPL window. There was nothing in the Event Log. *e was not updated in the REPL.
Once IntelliJ had finished indexing I was able to load the file in the REPL without problem. A "self-contained" (+ 1 1) seemed to work fine in these circumstances, but loading the namespace (which both reads and writes to the filesystem) reproducibly causes the problem.
The stack trace for this can be found in the log (Help -> Show log in...)
2016-04-25 21:08:57,729 [ 714612] ERROR - cursive.repl.nrepl - Error evaluating com.intellij.openapi.project.IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation at com.intellij.util.indexing.FileBasedIndexImpl.a (FileBasedIndexImpl.java:924) com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate (FileBasedIndexImpl.java:872) com.intellij.util.indexing.FileBasedIndexImpl.a (FileBasedIndexImpl.java:1000) com.intellij.util.indexing.FileBasedIndexImpl.a (FileBasedIndexImpl.java:1081) com.intellij.util.indexing.FileBasedIndexImpl.getValues (FileBasedIndexImpl.java:945) cursive.index$namespace_names.invoke (index.clj:356) cursive.repl.actions$namespaces$reify__10308.compute (actions.clj:241) com.intellij.openapi.application.impl.ApplicationImpl.runReadAction (ApplicationImpl.java:966) cursive.repl.actions$namespaces.invoke (actions.clj:240) cursive.repl.actions$load_file_BANG_.invoke (actions.clj:296) cursive.repl.actions$load_file$fn__10394.invoke (actions.clj:356) cursive.repl.nrepl$submit$fn__2792.invoke (nrepl.clj:125) clojure.lang.AFn.call (AFn.java:18) java.util.concurrent.FutureTask.run (FutureTask.java:266) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617) java.lang.Thread.run (Thread.java:745)
I've seen this issue a couple of times as well, last night and this morning across two different projects, when trying to rerun tests in the repl (re-run last test action in repl). Stack trace is identical to the above.
I've start too see this about once a week: Error evaluating - class com.intellij.openapi.project.IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
I just ran into this, too:
2024-07-19 14:52:05,063 [20534328] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.SdkEntity to files
2024-07-19 14:52:05,064 [20534329] INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities com.intellij.platform.workspace.jps.entities.LibraryEntity to files
2024-07-19 14:52:08,057 [20537322] INFO - #c.i.o.p.DumbServiceImpl - enter dumb mode [PROJECT_B]
2024-07-19 14:52:08,069 [20537334] INFO - #c.i.o.p.DumbServiceImpl - enter dumb mode [PROJECT_A]
2024-07-19 14:52:09,484 [20538749] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) com.intellij.openapi.roots.impl.PushedFilePropertiesUpdaterImpl$MyDumbModeTask@72c38991 (reason: Push on VFS changes)
2024-07-19 14:52:09,494 [20538759] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) com.intellij.openapi.roots.impl.PushedFilePropertiesUpdaterImpl$MyDumbModeTask@46867fa6 (reason: Push on VFS changes)
2024-07-19 14:52:09,518 [20538783] INFO - #c.i.o.c.i.s.StoreUtil - saveProjectsAndApp took 4455 ms
2024-07-19 14:52:09,611 [20538876] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) com.intellij.openapi.roots.impl.PushedFilePropertiesUpdaterImpl$MyDumbModeTask@72c38991 (reason: Push on VFS changes)
2024-07-19 14:52:09,728 [20538993] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) com.intellij.openapi.roots.impl.PushedFilePropertiesUpdaterImpl$MyDumbModeTask@46867fa6 (reason: Push on VFS changes)
2024-07-19 14:52:10,135 [20539400] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) UnindexedFilesIndexer[PROJECT_B, 0 iterators, reason: On refresh of files in PROJECT_B]
2024-07-19 14:52:10,140 [20539405] INFO - #c.i.u.i.c.IndexUpdateRunner - Using 3 indexing and 4 writing threads for indexing
2024-07-19 14:52:10,239 [20539504] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) UnindexedFilesIndexer[PROJECT_A, 0 iterators, reason: On refresh of files in PROJECT_A]
2024-07-19 14:52:10,246 [20539511] INFO - #c.i.u.i.c.IndexUpdateRunner - Using 3 indexing and 4 writing threads for indexing
2024-07-19 14:52:10,410 [20539675] INFO - #c.i.o.a.i.ActionUpdater - 318 ms to grab EDT for ToolWindowHeader$2#children@ToolwindowTitle (com.intellij.toolWindow.ToolWindowHeader$2)
2024-07-19 14:52:10,411 [20539676] INFO - #c.i.o.a.i.ActionUpdater - 332 ms to grab EDT for EditorMarkupModelImpl$TrafficLightAction#presentation@EditorInspectionsToolbar (com.intellij.openapi.editor.impl.EditorMarkupModelImpl$TrafficLightAction)
2024-07-19 14:52:10,411 [20539676] INFO - #c.i.o.a.i.ActionUpdater - 332 ms to grab EDT for EditorMarkupModelImpl$1#presentation@EditorInspectionsToolbar (com.intellij.openapi.editor.impl.EditorMarkupModelImpl$1)
2024-07-19 14:52:10,412 [20539677] INFO - #c.i.o.a.i.ActionUpdater - 332 ms to grab EDT for EditorMarkupModelImpl$TrafficLightAction#presentation@EditorInspectionsToolbar (com.intellij.openapi.editor.impl.EditorMarkupModelImpl$TrafficLightAction)
2024-07-19 14:52:10,412 [20539677] INFO - #c.i.o.a.i.ActionUpdater - 332 ms to grab EDT for EditorMarkupModelImpl$1#presentation@EditorInspectionsToolbar (com.intellij.openapi.editor.impl.EditorMarkupModelImpl$1)
2024-07-19 14:52:15,554 [20544819] INFO - #c.i.u.i.ProjectChangedFilesScanner - Retrieving changed during indexing files of PROJECT_A : 1 to update, calculated in 5308ms
2024-07-19 14:52:15,555 [20544820] INFO - #c.i.u.i.ProjectChangedFilesScanner - Retrieving changed during indexing files of PROJECT_B : 1 to update, calculated in 5414ms
2024-07-19 14:52:15,556 [20544821] SEVERE - #cursive.repl - Error evaluating
com.intellij.openapi.project.IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
at com.intellij.openapi.project.IndexNotReadyException.create (IndexNotReadyException.java:67)
com.intellij.util.indexing.FileBasedIndexImpl.handleDumbMode (FileBasedIndexImpl.java:843)
com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate (FileBasedIndexImpl.java:791)
com.intellij.util.indexing.FileBasedIndexEx.processExceptions (FileBasedIndexEx.java:296)
com.intellij.util.indexing.FileBasedIndexEx.processValueIterator (FileBasedIndexEx.java:391)
com.intellij.util.indexing.FileBasedIndexEx.processValuesInOneFile (FileBasedIndexEx.java:334)
com.intellij.util.indexing.FileBasedIndexImpl.processValuesInOneFile (FileBasedIndexImpl.java:1099)
com.intellij.util.indexing.FileBasedIndexEx.getValues (FileBasedIndexEx.java:117)
cursive.index$namespace_names.invokeStatic (index.clj:489)
cursive.index$namespace_names.invoke (index.clj:483)
cursive.repl.actions$namespaces$reify__10626.compute (actions.clj:298)
com.intellij.openapi.application.impl.RwLockHolder.runReadAction (RwLockHolder.kt:271)
com.intellij.openapi.application.impl.ApplicationImpl.runReadAction (ApplicationImpl.java:845)
cursive.repl.actions$namespaces.invokeStatic (actions.clj:297)
cursive.repl.actions$namespaces.invoke (actions.clj:293)
cursive.repl.actions$load_file_BANG_.invokeStatic (actions.clj:396)
cursive.repl.actions$load_file_BANG_.invoke (actions.clj:378)
cursive.repl.actions$load_file$fn__10739.invoke (actions.clj:496)
cursive.repl$submit$fn__1247.invoke (repl.clj:223)
clojure.lang.AFn.run (AFn.java:22)
com.intellij.openapi.application.impl.RwLockHolder$executeOnPooledThread$1.run (RwLockHolder.kt:154)
java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
com.intellij.util.concurrency.ContextCallable.call (ContextCallable.java:32)
java.util.concurrent.FutureTask.run (FutureTask.java:264)
com.intellij.util.concurrency.ContextRunnable.run (ContextRunnable.java:27)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run (Executors.java:702)
java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run (Executors.java:699)
java.security.AccessController.doPrivileged (AccessController.java:399)
java.util.concurrent.Executors$PrivilegedThreadFactory$1.run (Executors.java:699)
java.lang.Thread.run (Thread.java:840)
java.lang.Throwable: Error evaluating
com.intellij.openapi.project.IndexNotReadyException: Please change caller according to com.intellij.openapi.project.IndexNotReadyException documentation
at com.intellij.openapi.project.IndexNotReadyException.create (IndexNotReadyException.java:67)
com.intellij.util.indexing.FileBasedIndexImpl.handleDumbMode (FileBasedIndexImpl.java:843)
com.intellij.util.indexing.FileBasedIndexImpl.ensureUpToDate (FileBasedIndexImpl.java:791)
com.intellij.util.indexing.FileBasedIndexEx.processExceptions (FileBasedIndexEx.java:296)
com.intellij.util.indexing.FileBasedIndexEx.processValueIterator (FileBasedIndexEx.java:391)
com.intellij.util.indexing.FileBasedIndexEx.processValuesInOneFile (FileBasedIndexEx.java:334)
com.intellij.util.indexing.FileBasedIndexImpl.processValuesInOneFile (FileBasedIndexImpl.java:1099)
com.intellij.util.indexing.FileBasedIndexEx.getValues (FileBasedIndexEx.java:117)
cursive.index$namespace_names.invokeStatic (index.clj:489)
cursive.index$namespace_names.invoke (index.clj:483)
cursive.repl.actions$namespaces$reify__10626.compute (actions.clj:298)
com.intellij.openapi.application.impl.RwLockHolder.runReadAction (RwLockHolder.kt:271)
com.intellij.openapi.application.impl.ApplicationImpl.runReadAction (ApplicationImpl.java:845)
cursive.repl.actions$namespaces.invokeStatic (actions.clj:297)
cursive.repl.actions$namespaces.invoke (actions.clj:293)
cursive.repl.actions$load_file_BANG_.invokeStatic (actions.clj:396)
cursive.repl.actions$load_file_BANG_.invoke (actions.clj:378)
cursive.repl.actions$load_file$fn__10739.invoke (actions.clj:496)
cursive.repl$submit$fn__1247.invoke (repl.clj:223)
clojure.lang.AFn.run (AFn.java:22)
com.intellij.openapi.application.impl.RwLockHolder$executeOnPooledThread$1.run (RwLockHolder.kt:154)
java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:539)
com.intellij.util.concurrency.ContextCallable.call (ContextCallable.java:32)
java.util.concurrent.FutureTask.run (FutureTask.java:264)
com.intellij.util.concurrency.ContextRunnable.run (ContextRunnable.java:27)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1136)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:635)
java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run (Executors.java:702)
java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run (Executors.java:699)
java.security.AccessController.doPrivileged (AccessController.java:399)
java.util.concurrent.Executors$PrivilegedThreadFactory$1.run (Executors.java:699)
java.lang.Thread.run (Thread.java:840)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at cursive.logging$do_error.invokeStatic(logging.clj:60)
at cursive.logging$do_error.invoke(logging.clj:59)
at cursive.logging$do_log.invokeStatic(logging.clj:45)
at cursive.logging$do_log.doInvoke(logging.clj:38)
at clojure.lang.RestFn.invoke(RestFn.java:467)
at cursive.repl$print_exception.invokeStatic(repl.clj:187)
at cursive.repl$print_exception.invoke(repl.clj:185)
at cursive.repl$submit$fn__1247.invoke(repl.clj:225)
at clojure.lang.AFn.run(AFn.java:22)
at com.intellij.openapi.application.impl.RwLockHolder$executeOnPooledThread$1.run(RwLockHolder.kt:154)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:32)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:840)
2024-07-19 14:52:15,563 [20544828] SEVERE - #cursive.repl - IntelliJ IDEA 2024.1.4 Build #IU-241.18034.62
2024-07-19 14:52:15,563 [20544828] SEVERE - #cursive.repl - JDK: 17.0.11; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2024-07-19 14:52:15,563 [20544828] SEVERE - #cursive.repl - OS: Linux
2024-07-19 14:52:15,563 [20544828] SEVERE - #cursive.repl - Plugin to blame: Cursive version: 1.13.4-eap7-2024.1
2024-07-19 14:52:15,563 [20544828] SEVERE - #cursive.repl - Last Action: :cursive.repl.actions/load-file
2024-07-19 14:52:15,566 [20544831] INFO - #c.i.u.i.UnindexedFilesIndexer - Finished for PROJECT_A. Unindexed files update took 5321ms; general responsiveness: 0/7 sluggish, 2/7 very slow; EDT responsiveness: ok
2024-07-19 14:52:15,567 [20544832] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) UnindexedFilesIndexer[PROJECT_A, 0 iterators, reason: On refresh of files in PROJECT_A]
2024-07-19 14:52:15,580 [20544845] INFO - #c.i.u.i.UnindexedFilesIndexer - Finished for PROJECT_B. Unindexed files update took 5441ms; general responsiveness: 0/7 sluggish, 2/7 very slow; EDT responsiveness: ok
2024-07-19 14:52:15,582 [20544847] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) UnindexedFilesIndexer[PROJECT_B, 0 iterators, reason: On refresh of files in PROJECT_B]
2024-07-19 14:52:15,582 [20544847] INFO - #c.i.o.p.MergingQueueGuiExecutor - Running task: (dumb mode task) UnindexedFilesIndexer[PROJECT_B, 0 iterators, reason: On refresh of files in PROJECT_B]
2024-07-19 14:52:15,584 [20544849] INFO - #c.i.o.p.DumbServiceImpl - exit dumb mode [PROJECT_A]
2024-07-19 14:52:15,584 [20544849] INFO - #c.i.u.i.c.IndexUpdateRunner - Using 3 indexing and 4 writing threads for indexing
2024-07-19 14:52:15,585 [20544850] INFO - #c.i.u.i.ProjectChangedFilesScanner - Retrieving changed during indexing files of PROJECT_B : 0 to update, calculated in 0ms
2024-07-19 14:52:15,608 [20544873] INFO - #c.i.u.i.UnindexedFilesIndexer - Finished for PROJECT_B. Unindexed files update took 24ms; general responsiveness: ok; EDT responsiveness: ok
2024-07-19 14:52:15,613 [20544878] INFO - #c.i.o.p.MergingQueueGuiExecutor - Task finished: (dumb mode task) UnindexedFilesIndexer[PROJECT_B, 0 iterators, reason: On refresh of files in PROJECT_B]
2024-07-19 14:52:15,697 [20544962] INFO - #c.i.o.p.DumbServiceImpl - exit dumb mode [PROJECT_B]
After this the nREPL was stuck and I could no longer load files into it, until I restarted it (just the nREPL, not IntelliJ).
What I was doing shortly before this happened:
- Start nREPL, but could not connect because port file contained wrong info
- Start nREPL with fixed host and port
- Clicked "clear history" trash icon while nREPL was still connecting
- Maybe also (mis-) clicked "reconnect" circular arrow icon while nREPL was connecting