vscode-kotlin icon indicating copy to clipboard operation
vscode-kotlin copied to clipboard

Activating extension `fwcd.kotlin` failed

Open Goddchen opened this issue 5 years ago • 11 comments

Hi!

I'm having issues opening a folder which contains multiple projects in subdirectories. They contain Maven projects and are made up of a mixture of Java and Kotlin files. The Java language server works fine, but the Kotlin one doesn't start (it works fine when I open single projects).

The exception thrown is:

[Extension Host] Here is the error stack:  Error: Internal error.
	at handleResponse (/Users/martinliersch/.vscode/extensions/fwcd.kotlin-0.1.12/node_modules/vscode-jsonrpc/lib/main.js:436:48)
	at processMessageQueue (/Users/martinliersch/.vscode/extensions/fwcd.kotlin-0.1.12/node_modules/vscode-jsonrpc/lib/main.js:263:17)
	at Immediate.setImmediate [as _onImmediate] (/Users/martinliersch/.vscode/extensions/fwcd.kotlin-0.1.12/node_modules/vscode-jsonrpc/lib/main.js:247:13)
	at runCallback (timers.js:789:20)
	at tryOnImmediate (timers.js:751:5)
	at processImmediate [as _immediateCallback] (timers.js:722:5)

Any ideas?

Goddchen

Goddchen avatar Feb 04 '19 09:02 Goddchen

seems same question on my vscode when active the plugin

[2020-01-03 09:36:40.630] [exthost] [info] ExtensionService#_doActivateExtension fwcd.kotlin {"startup":false,"extensionId":{"value":"fwcd.kotlin","_lower":"fwcd.kotlin"},"activationEvent":"onLanguage:kotlin"}
[2020-01-03 09:36:40.630] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/allen/.vscode-exploration/extensions/fwcd.kotlin-0.2.11/out/extension
[2020-01-03 09:36:47.448] [exthost] [error] Activating extension fwcd.kotlin failed due to an error:
[2020-01-03 09:36:47.449] [exthost] [error] Error: Internal error.
	at handleResponse (/Users/allen/.vscode-exploration/extensions/fwcd.kotlin-0.2.11/node_modules/vscode-jsonrpc/lib/main.js:436:48)
	at processMessageQueue (/Users/allen/.vscode-exploration/extensions/fwcd.kotlin-0.2.11/node_modules/vscode-jsonrpc/lib/main.js:263:17)
	at Immediate.<anonymous> (/Users/allen/.vscode-exploration/extensions/fwcd.kotlin-0.2.11/node_modules/vscode-jsonrpc/lib/main.js:247:13)
	at processImmediate (internal/timers.js:439:21)

fyeeme avatar Jan 03 '20 01:01 fyeeme

here is the screenshot image

fyeeme avatar Jan 03 '20 01:01 fyeeme

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
        at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
        at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
        at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
        ... 11 more
Caused by: java.lang.IllegalArgumentException: Illegal character in path at index 40: file:///Users/user/Documents/Some App/tut-spring-boot-kotlin
        at java.base/java.net.URI.create(URI.java:906)
        at org.javacs.kt.util.URIsKt.parseURI(URIs.kt:14)
        at org.javacs.kt.KotlinLanguageServer.initialize(KotlinLanguageServer.kt:73)
        ... 16 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 40: file:///Users/user/Documents/Some App/tut-spring-boot-kotlin
        at java.base/java.net.URI$Parser.fail(URI.java:2936)
        at java.base/java.net.URI$Parser.checkChars(URI.java:3107)
        at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3189)
        at java.base/java.net.URI$Parser.parse(URI.java:3137)
        at java.base/java.net.URI.<init>(URI.java:623)
        at java.base/java.net.URI.create(URI.java:904)
        ... 18 more

So when I dug into the stack trace, it turned out the space in the directory was causing the issue for me:

Illegal character in path at index 40: file:///Users/user/Documents/Some App/tut-spring-boot-kotlin

So as a work around I just got rid of the space in "Some App" and it worked.

samdoctor avatar May 02 '20 23:05 samdoctor

@samdoctor That is a known issue, tracked here: https://github.com/fwcd/kotlin-language-server/issues/200

fwcd avatar May 02 '20 23:05 fwcd

@samdoctor How did you do to dig into the stack trace ?

stephaneeybert avatar Dec 17 '21 10:12 stephaneeybert

My log output shows:

SEVERE: Internal error: java.lang.IllegalArgumentException: Unable to find the 'mvn' command
java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Unable to find the 'mvn' command
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1702)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: Unable to find the 'mvn' command
	at org.javacs.kt.classpath.MavenClassPathResolverKt$mvnCommand$2.invoke(MavenClassPathResolver.kt:129)
	at org.javacs.kt.classpath.MavenClassPathResolverKt$mvnCommand$2.invoke(MavenClassPathResolver.kt:128)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at org.javacs.kt.classpath.MavenClassPathResolverKt.getMvnCommand(MavenClassPathResolver.kt:128)
	at org.javacs.kt.classpath.MavenClassPathResolverKt.generateMavenDependencyList(MavenClassPathResolver.kt:106)
	at org.javacs.kt.classpath.MavenClassPathResolverKt.access$generateMavenDependencyList(MavenClassPathResolver.kt:1)
	at org.javacs.kt.classpath.MavenClassPathResolver.getClasspathWithSources(MavenClassPathResolver.kt:37)
	at org.javacs.kt.classpath.UnionClassPathResolver.<init>(ClassPathResolver.kt:57)
	at org.javacs.kt.classpath.ClassPathResolverKt.plus(ClassPathResolver.kt:45)
	at org.javacs.kt.classpath.ClassPathResolverKt.getJoined(ClassPathResolver.kt:40)
	at org.javacs.kt.classpath.DefaultClassPathResolverKt.defaultClassPathResolver(DefaultClassPathResolver.kt:11)
	at org.javacs.kt.CompilerClassPath.refresh(CompilerClassPath.kt:37)
	at org.javacs.kt.CompilerClassPath.refresh$default(CompilerClassPath.kt:31)
	at org.javacs.kt.CompilerClassPath.addWorkspaceRoot(CompilerClassPath.kt:98)
	at org.javacs.kt.KotlinLanguageServer$initialize$1.invoke(KotlinLanguageServer.kt:117)
	at org.javacs.kt.KotlinLanguageServer$initialize$1.invoke(KotlinLanguageServer.kt:71)
	at org.javacs.kt.util.AsyncExecutor.compute$lambda-2(AsyncExecutor.kt:19)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	... 3 more

VSCode 1.63.2

stephaneeybert avatar Dec 17 '21 12:12 stephaneeybert

@stephaneeybert I have the same problem these days, but i resolved it by setting the mvn PATH just now

twislyn avatar Jun 25 '22 02:06 twislyn

I am having this problem with version 0.2.26. Here are the logs.

2023-01-15 16:42:52.102 [error] Activating extension fwcd.kotlin failed due to an error:
2023-01-15 16:42:52.102 [error] Error: Internal error.
    at handleResponse (/Users/susanthapa/.vscode/extensions/fwcd.kotlin-0.2.26/node_modules/vscode-jsonrpc/lib/common/connection.js:477:48)
    at processMessageQueue (/Users/susanthapa/.vscode/extensions/fwcd.kotlin-0.2.26/node_modules/vscode-jsonrpc/lib/common/connection.js:292:17)
    at Immediate.<anonymous> (/Users/susanthapa/.vscode/extensions/fwcd.kotlin-0.2.26/node_modules/vscode-jsonrpc/lib/common/connection.js:276:13)
    at processImmediate (node:internal/timers:466:21)
2023-01-15 16:42:53.115 [error] Error: write after end
    at new NodeError (node:internal/errors:371:5)
    at _write (node:internal/streams/writable:319:11)
    at Socket.write (node:internal/streams/writable:334:10)
    at /Users/susanthapa/.vscode/extensions/fwcd.kotlin-0.2.26/node_modules/vscode-jsonrpc/lib/node/ril.js:90:29
    at new Promise (<anonymous>)
    at u.write (/Users/susanthapa/.vscode/extensions/fwcd.kotlin-0.2.26/node_modules/vscode-jsonrpc/lib/node/ril.js:80:16)
    at g.doWrite (/Users/susanthapa/.vscode/extensions/fwcd.kotlin-0.2.26/node_modules/vscode-jsonrpc/lib/common/messageWriter.js:100:33)
    at /Users/susanthapa/.vscode/extensions/fwcd.kotlin-0.2.26/node_modules/vscode-jsonrpc/lib/common/messageWriter.js:91:29

susonthapa avatar Jan 15 '23 12:01 susonthapa

I have the same Error: write after end variant too

timolehto avatar Jan 16 '23 15:01 timolehto

For me, installing the mvn maven command fixed the Error: write after end, even if I'm not using maven in my project.

izaban avatar Jan 19 '23 18:01 izaban

@izaban I tried installing mvn with Homebrew but I am still getting the same error. By the way, I am running a ReactNative project so don't know if this is specific to ReactNative.

susonthapa avatar Jan 20 '23 02:01 susonthapa

Hey thanks @susonthapa, it seems to work. At least partially. I still get some errors loading the workspace: image but e.g. navigating to definition seems to now work, so I guess it sort of works. It doesn't seem to support running specs anyways so I guess this is pretty much all it supports. 👍

timolehto avatar Jan 23 '23 18:01 timolehto