Closed skylize closed 2 years ago
Definitely an upstream issue in Clojure LSP. To all appearances seems to be fixed in nightly build of CLojure LSP.
As mentioned above the Internal error (-32603)
is a problem in the Clojure LSP.
This happens when there are URI-escaped (e.g. non-ASCII) characters in URI corresponding to the
the file name, e.g. for a source file called hôpital.clj
.
You can work around the issue by using ASCII-only file names and paths, e.g. misspelling the file name as hopital.clj
.
To save you some time, here is some troubleshooting information to help if you encounter this error.
Clojure LSP creates a log file where you can see the full stack trace. See information about where to find this file here: https://clojure-lsp.io/troubleshooting/
You will see a stack trace like this:
2024-07-18T07:56:15.523Z ERROR [clojure-lsp.server:55] - Error receiving message: Internal error (-32603)
{:id 28, :method "textDocument/semanticTokens/range"}
com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine PlatformThreads.java: 872
com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine PlatformThreads.java: 896
java.util.concurrent.ForkJoinWorkerThread.run ForkJoinWorkerThread.java: 188
java.util.concurrent.ForkJoinPool.runWorker ForkJoinPool.java: 1808
java.util.concurrent.ForkJoinPool.scan ForkJoinPool.java: 1843
java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec ForkJoinPool.java: 1312
java.util.concurrent.ForkJoinTask.doExec ForkJoinTask.java: 387
java.util.concurrent.CompletableFuture$AsyncSupply.exec CompletableFuture.java: 1760
java.util.concurrent.CompletableFuture$AsyncSupply.run CompletableFuture.java: 1768
promesa.util.Supplier/get util.cljc: 34
promesa.exec/wrap-bindings/fn exec.cljc: 163
clojure-lsp.server/fn/fn server.clj: 367
clojure-lsp.handlers/semantic-tokens-range handlers.clj: 435
clojure-lsp.handlers/skip-feature-for-uri? handlers.clj: 142
clojure-lsp.shared/uri->filename shared.clj: 223
clojure-lsp.shared/uri-obj->filepath shared.clj: 179
java.nio.file.Paths.get Paths.java: 98
java.nio.file.Path.of Path.java: 204
sun.nio.fs.UnixFileSystemProvider.getPath UnixFileSystemProvider.java: 125
sun.nio.fs.UnixUriUtils.fromUri UnixUriUtils.java: 88
java.lang.IllegalArgumentException: Bad escape
This stacktrace shows that Clojure LSP cannot figure out the path to your source file.
The cause is a bug in the conversion from the VS Code supplied URI for the file to the corresponding path, see the clojure-lsp.shared/uri-obj->filepath
function for details.
Seeing these popups quite frequently. Another user posted a screenshot of the popup in Clojurians: thread p1663365121814349. The Ouput View shows:
So far, I have not spotted any negative side effects, beyond the distraction of the popup. The only pattern I have noticed is that it seems to trigger while my code is in an invalid state. Perhaps an upstream bug, with LSP choking on certain types of broken forms?
I'll let you know if I learn more.