Repository navigation
Closed
Description
java.util.concurrent.CompletionException: com.redhat.devtools.lsp4ij.server.CannotStartProcessException: com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "gopls": CreateProcess error=2, The system cannot find the file specified
at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:323)
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:376)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:391)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:657)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:531)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2221)
at com.redhat.devtools.lsp4ij.LanguageServerWrapper.lambda$start$16(LanguageServerWrapper.java:539)
at java.base/java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:1011)
at java.base/java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:995)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:531)
at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2221)
at com.redhat.devtools.lsp4ij.LanguageServerWrapper.lambda$start$5(LanguageServerWrapper.java:433)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:381)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
at com.intellij.util.concurrency.ContextCallable.lambda$call$1(ContextCallable.java:86)
at com.intellij.concurrency.ThreadContext.installThreadContext(threadContext.kt:305)
at com.intellij.util.concurrency.ContextCallable.lambda$call$2(ContextCallable.java:83)
at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:96)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:192)
at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:192)
at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:198)
at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:192)
at com.intellij.util.concurrency.ContextRunnable.lambda$run$0(ContextRunnable.java:26)
at com.intellij.concurrency.ThreadContext.resetThreadContext(threadContext.kt:294)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:25)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:649)
at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: com.redhat.devtools.lsp4ij.server.CannotStartProcessException: com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "gopls": CreateProcess error=2, The system cannot find the file specified
at com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider.start(OSProcessStreamConnectionProvider.java:130)
at com.redhat.devtools.lsp4ij.LanguageServerWrapper.lambda$start$5(LanguageServerWrapper.java:418)
... 18 more
Caused by: com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "gopls": CreateProcess error=2, The system cannot find the file specified
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:436)
at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:85)
at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:45)
at com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider$1.<init>(OSProcessStreamConnectionProvider.java:114)
at com.redhat.devtools.lsp4ij.server.OSProcessStreamConnectionProvider.start(OSProcessStreamConnectionProvider.java:114)
... 19 more
Caused by: java.io.IOException: Cannot run program "gopls": CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1112)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1046)
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:583)
at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:599)
at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:446)
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:416)
... 23 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:485)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:146)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1078)
... 28 more
Metadata
Metadata
Assignees
Labels
No labels
Activity
angelozerr commentedon Jun 12, 2026
SergejSalnikov commentedon Jun 23, 2026
The core problem
Look at
LanguageServerWrapper.javalines 436-543this.initializeFutureis assigned to the result of the entire chain, including the.exceptionally()handler. The.exceptionally()handler is supposed to be a recovery — it receives the error, handles it (logs, shows notification), and returnsnull, which would makeinitializeFuturecomplete normally withnull.But before returning
null, line 539 callsinitializeFuture.completeExceptionally(serverError). This force-completes the very same future with an exception, overriding the normal recovery. Thereturn nullon line 542 is now a no-op because the future is already completed.How this causes both exceptions
Exception 1 is the stack trace of line 539 itself firing. The
CompletionExceptionin Exception 1's stack trace is created atUniApply.tryFire— meaning some other code elsewhere has chained a.thenApply()oninitializeFuture. WheninitializeFutureis force-completed exceptionally, that dependent fires and wraps the error in aCompletionException. That dependent doesn't handle the exception either, so it propagates.Exception 2 is the consequence: that unhandled
CompletionExceptionreaches the EDT (likely via a.thenAccept()/.whenComplete()scheduled on the EDT to update UI), and since nothing catches it, it crashes as anUnhandledException.Why the wrapping is wrong
The
.exceptionally()handler's contract is:By calling
initializeFuture.completeExceptionally(), the handler re-injects the error into the very future it was supposed to protect. The exception escapes the error boundary and reaches consumers ofinitializeFuturethat rightfully expect the.exceptionally()handler to have dealt with it.Proposed fix
Remove line 539 (
initializeFuture.completeExceptionally(serverError)). The.exceptionally()handler already does the right things (storesserverError, shows notification, stops the server). Thereturn nullwill letinitializeFuturecomplete normally, and any consumer ofinitializeFuturewill getnull(meaning "server didn't start") rather than an unhandled exception blowing up on the EDT.If some downstream consumers of
initializeFutureneed to know the server failed, they should checkserverErrororServerStatusrather than relying on the future completing exceptionally.fix: don't throw a failed code lens request on the UI thread when the…