Skip to content

java.util.concurrent.CompletionException: com.redhat.devtools.lsp4ij.server.CannotStartProcessException: #1600

Closed

Description

@angelozerr
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

Activity

  1. angelozerr commented on Jun 12, 2026

    @angelozerr
    ContributorAuthor
    Unhandled exception in EDT
    
    com.intellij.openapi.diagnostic.UnhandledException: 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.intellij.openapi.application.impl.ExceptionsKt.processUnhandledException(exceptions.kt:55)
    	at com.intellij.platform.ide.bootstrap.StartupErrorReporter.processException(StartupErrorReporter.java:338)
    	at com.intellij.ide.IdeEventQueue.processException(IdeEventQueue.kt:466)
    	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:728)
    	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:574)
    	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$0$0$0$0(IdeEventQueue.kt:382)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:928)
    	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$0$0$0(IdeEventQueue.kt:381)
    	at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$0(IdeEventQueue.kt:1111)
    	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
    	at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1111)
    	at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$0(IdeEventQueue.kt:376)
    	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:408)
    	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
    Caused by: 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
    
    
  2. SergejSalnikov commented on Jun 23, 2026

    @SergejSalnikov

    The core problem

    Look at LanguageServerWrapper.java lines 436-543

    this.initializeFuture = startFuture       // line 436
        .thenApply(...)
        .thenCompose(...)
        .thenApply(...)
        .thenApply(...)
        .thenRun(...)
        .exceptionally(e -> {                  // line 529
            // ...
            initializeFuture.completeExceptionally(serverError);  // line 539 ← BUG
            // ...
            return null;                       // line 542
        });

    this.initializeFuture is 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 returns null, which would make initializeFuture complete normally with null.

    But before returning null, line 539 calls initializeFuture.completeExceptionally(serverError). This force-completes the very same future with an exception, overriding the normal recovery. The return null on 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 CompletionException in Exception 1's stack trace is created at UniApply.tryFire — meaning some other code elsewhere has chained a .thenApply() on initializeFuture. When initializeFuture is force-completed exceptionally, that dependent fires and wraps the error in a CompletionException. That dependent doesn't handle the exception either, so it propagates.

    Exception 2 is the consequence: that unhandled CompletionException reaches the EDT (likely via a .thenAccept()/.whenComplete() scheduled on the EDT to update UI), and since nothing catches it, it crashes as an UnhandledException.

    Why the wrapping is wrong

    The .exceptionally() handler's contract is:

    • Catch the error → ✅ it does this
    • Handle it (log, notify) → ✅ it does this
    • Recover by returning a value → ❌ defeated by line 539

    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 of initializeFuture that 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 (stores serverError, shows notification, stops the server). The return null will let initializeFuture complete normally, and any consumer of initializeFuture will get null (meaning "server didn't start") rather than an unhandled exception blowing up on the EDT.

    If some downstream consumers of initializeFuture need to know the server failed, they should check serverError or ServerStatus rather than relying on the future completing exceptionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions