Blarc / ai-commits-intellij-plugin

AI Commits for IntelliJ based IDEs/Android Studio.
https://plugins.jetbrains.com/plugin/21335-ai-commits
MIT License
283 stars 33 forks source link

Null pointer Exception #239

Closed Pipboyguy closed 2 months ago

Pipboyguy commented 2 months ago

Pycharm professional 2024.2.1:

Unhandled exception in [ComponentManager(ApplicationImpl@1274270336), CoroutineName(com.github.blarc.ai.commits.intellij.plugin.settings.clients.openAi.OpenAiClientService), Dispatchers.Default]

java.lang.NullPointerException: Cannot invoke "java.util.Vector.add(Object)" because "this.viewBuffer" is null
    at java.desktop/javax.swing.text.FlowView$FlowStrategy.layoutRow(FlowView.java:590)
    at java.desktop/javax.swing.text.FlowView$FlowStrategy.layout(FlowView.java:503)
    at java.desktop/javax.swing.text.FlowView.layout(FlowView.java:209)
    at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
    at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
    at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:335)
    at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:710)
    at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
    at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
    at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:335)
    at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:710)
    at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
    at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1823)
    at java.desktop/javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:943)
    at java.desktop/javax.swing.JComponent.getPreferredSize(JComponent.java:1730)
    at java.desktop/javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1390)
    at com.intellij.ui.components.JBLabel.updateTextAlignment(JBLabel.java:406)
    at com.intellij.ui.components.JBLabel.setText(JBLabel.java:175)
    at com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientService$verifyConfiguration$1$2.invokeSuspend(LLMClientService.kt:50)
    at com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientService$verifyConfiguration$1$2.invoke(LLMClientService.kt)
    at com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientService$verifyConfiguration$1$2.invoke(LLMClientService.kt)
    at com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientService.sendRequest(LLMClientService.kt:71)
    at com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientService.access$sendRequest(LLMClientService.kt:19)
    at com.github.blarc.ai.commits.intellij.plugin.settings.clients.LLMClientService$sendRequest$1.invokeSuspend(LLMClientService.kt)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:608)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:873)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:763)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:750)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [ComponentManager(ApplicationImpl@1274270336), CoroutineName(com.github.blarc.ai.commits.intellij.plugin.settings.clients.openAi.OpenAiClientService), StandaloneCoroutine{Cancelled}@2b00d35a, Dispatchers.Default]
Blarc commented 2 months ago

Hey @Pipboyguy,

is this something that you can repeat / happens often?

~Not sure if it's something I can fix, since it happens inside of javax swing component.~

The problem is probably thread context - not run on the UI thread.

Pipboyguy commented 2 months ago

@Blarc It was somewhat intermittent and I can't remember the provider. I'll post it on here if it happens again. Can you please let me know exactly what you'd need? Full jetbrains logs? where to find it?

Blarc commented 2 months ago

@Pipboyguy I'm pretty sure this should now be fixed, but if it happens again with the new version, please just post the stacktrace like you did before. Thanks a lot 🙏