Skip to content

Exception in IDE if trying to do the message with context #1139

@asuasu

Description

@asuasu

What happened?

Good day.

Recently every time I am trying to ask the model anything in chat with context added I receive following exception.

I use custom OpenAI API endpoint, and without context it works good as before.

GoLand version: 2025.2.3

Please tell if you need more info for diagnostics.

Relevant log output or stack trace

com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Read access is allowed from inside read-action only (see Application.runReadAction()); If you access or modify model on EDT consider wrapping your code in WriteIntentReadAction  or ReadAction; see https://jb.gg/ij-platform-threading for details
Current thread: Thread[#2712,ApplicationImpl pooled thread 382,4,main] 268105845 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[#86,AWT-EventQueue-0,6,main] 1261080193
	at com.intellij.util.concurrency.ThreadingAssertions.createThreadAccessException(ThreadingAssertions.java:257)
	at com.intellij.util.concurrency.ThreadingAssertions.throwThreadAccessException(ThreadingAssertions.java:248)
	at com.intellij.util.concurrency.ThreadingAssertions.assertReadAccess(ThreadingAssertions.java:138)
	at com.intellij.openapi.editor.impl.EditorThreading.assertInteractionAllowed(EditorThreading.kt:30)
	at com.intellij.openapi.editor.impl.CaretImpl.hasSelection(CaretImpl.java:1019)
	at com.intellij.openapi.editor.SelectionModel.hasSelection(SelectionModel.java:133)
	at com.intellij.openapi.editor.SelectionModel.hasSelection(SelectionModel.java:122)
	at ee.carlrobert.codegpt.ui.textarea.SelectionTagProcessor.process(TagProcessorFactory.kt:90)
	at ee.carlrobert.codegpt.toolwindow.chat.MessageBuilder.processTags(MessageBuilder.kt:59)
	at ee.carlrobert.codegpt.toolwindow.chat.MessageBuilder.withInlays(MessageBuilder.kt:16)
	at ee.carlrobert.codegpt.toolwindow.chat.ChatToolWindowTabPanel.lambda$handleSubmit$14(ChatToolWindowTabPanel.java:434)
	at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:326)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at com.intellij.util.concurrency.ContextCallable.lambda$call$1(ContextCallable.java:86)
	at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:95)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:173)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:167)
	at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Steps to reproduce

  • add the context (select some code and press CMD+shift+I)
  • write some message
  • try to sent the request

CodeGPT version

3.6.2-241.1

Operating System

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions