sourcegraph / jetbrains

Apache License 2.0
71 stars 23 forks source link

Cody failed to start for project inside WSL2 #1908

Open vuhoanglam opened 3 months ago

vuhoanglam commented 3 months ago

IDE Information

GoLand 2024.1.4 Build #GO-241.18034.61, built on June 21, 2024 Licensed to Duc Hoang Subscription is active until September 11, 2024. For educational use only. Runtime version: 17.0.11+1-b1207.24 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 8 Registry: debugger.new.tool.window.layout=true ide.completion.variant.limit=500 suggest.all.run.configurations.from.context=true ide.experimental.ui=true go.run.processes.with.pty=false terminal.new.ui=true Non-Bundled Plugins: cn.xiaoheiban.go-zero (1.1.9) Statistic (4.2.14) com.jetbrains.twig (241.18034.82) com.jetbrains.space (241.18034.4) com.sourcegraph.jetbrains (6.0.14)

Bug Description

Cody failed to start for project inside WSL2

Additional context

Stacktrace:

java.util.concurrent.ExecutionException: com.sourcegraph.cody.agent.CodyAgentException: Creating agent unsuccessful: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")

Error: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")
    at f2 (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38531:21)
    at e4.t4 (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38546:88)
    at new e4 (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38588:40)
    at t4.parse (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38560:25)
    at _Uri.parse (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:94115:48)
    at C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:138478:49
    at C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:138157:50
    at handleRequest (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131492:33)
    at handleMessage (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131359:11)
    at processMessageQueue (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131378:13)
    at Immediate.<anonymous> (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131354:11)
    at process.processImmediate (node:internal/timers:478:21)
    at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
    at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
    at com.sourcegraph.cody.agent.CodyAgentService.startAgent$lambda$4(CodyAgentService.kt:192)
    at com.intellij.openapi.application.impl.RwLockHolder$executeOnPooledThread$1.run(RwLockHolder.kt:154)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: com.sourcegraph.cody.agent.CodyAgentException: Creating agent unsuccessful: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")

Error: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")
    at f2 (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38531:21)
    at e4.t4 (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38546:88)
    at new e4 (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38588:40)
    at t4.parse (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:38560:25)
    at _Uri.parse (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:94115:48)
    at C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:138478:49
    at C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:138157:50
    at handleRequest (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131492:33)
    at handleMessage (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131359:11)
    at processMessageQueue (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131378:13)
    at Immediate.<anonymous> (C:\Users\test\AppData\Roaming\JetBrains\GoLand2024.1\plugins\Sourcegraph\agent\index.js:131354:11)
    at process.processImmediate (node:internal/timers:478:21)
GlebDevyatkin-Figured commented 2 months ago

Same error with PHPstorm:

Error: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")

That is probably related to WSL2 path starting \\, e.g. \\wsl$\Ubuntu\home\user\project\file1.php or \\wsl.localhost\Ubuntu\home\user\project\file1.php.

PhpStorm 2024.2.0.1
Build #PS-242.20224.427, built on August 21, 2024
com.sourcegraph.jetbrains (6.0.34)

As a workaround, I tried to mount WSL2 as network disk and Cody start working as expected, but that is creating many other problems with IDE, files monitoring, other plugins, etc.

Really hope it will be fixed soon.

UPD: Cody Chat windows is working, Autosuggestion is not.

d-lindahl commented 3 weeks ago

In the latest version (v7.0.13) Cody now fails completely for projects residing in WSL2 with the same error as above. Reverting to 7.0.6 makes it work again (but no autosuggestions)

Error: [UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")
GlebDevyatkin-Figured commented 3 weeks ago
PhpStorm 2024.2.0.1
Build #PS-242.20224.427, built on August 21, 2024
com.sourcegraph.jetbrains (7.0.13)

Working fine-ish for me, at least not many errors and autosuggestion working as expected. Still can't apply suggestions, Cody trying to create new file in C:\wsl.localhost\Ubuntu\home\...\filename.php instead of doing it proper place.

Another issue is that I'm always need to have Cody sidebar open and create new chat to ask to "Edit code...", but since version 7 that is at least available for WSL2 projects