You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will be a bit hard to explain/reproduce, but I still thought it was worth creating an issue for and I can try to dig in further, but it seems that at times when you open a repo that you've already had open before in the past and try to get coding certain BSP requests might fail leaving you in state where Metals doesn't really show you any errors, but nothing is working. Part of this is the BSP server failing, but I also think we can do a better job on the Metals side trying to detect these situations and providing useful information about how to address the issue.
Here is the situation I just hit on. I had worked on the coursier code base on the main branch, but this morning I checked out a pr and just opened the codebase. I had been using mill-bsp so that was being used again. Nothing errored out on me on the user side, but also nothing worked after the indexing finished. No hovers, no goto definitions, nothing. So seemingly no PC or semanticdb features were working. Looking at the metals logs there is an exception that was thrown, but never surfaced.
2023.01.05 09:17:18 INFO time: compiled cache.js[2.12.17] in 1.04s�[0m
2023.01.05 09:17:18 INFO compiling target coursier.js[2.12.17]�[0m
Jan 05, 2023 9:17:27 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
WARNING: Notification threw an exception: {
"jsonrpc": "2.0",
"method": "build/publishDiagnostics",
"params": {
"textDocument": {
"uri": "file:///Users/ckipp/Documents/scala-workspace/coursier-org/coursier/coursier/js/2.12.17?id\u003dcoursier.js[2.12.17]"
},
"buildTarget": {
"uri": "file:///Users/ckipp/Documents/scala-workspace/coursier-org/coursier/coursier/js/2.12.17?id\u003dcoursier.js[2.12.17]"
},
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"severity": 2,
"source": "mill",
"message": "two feature warnings; re-run with -feature for details"
}
],
"reset": true
}
}
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.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:114)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
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: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.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 12 more
Caused by: java.lang.IllegalArgumentException: URI has a query component
at java.base/sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:58)
at java.base/sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:102)
at java.base/java.nio.file.Path.of(Path.java:203)
at java.base/java.nio.file.Paths.get(Paths.java:98)
at scala.meta.internal.mtags.MtagsEnrichments$XtensionURIMtags.toAbsolutePath(MtagsEnrichments.scala:119)
at scala.meta.internal.mtags.MtagsEnrichments$XtensionStringMtags.toAbsolutePath(MtagsEnrichments.scala:158)
at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:609)
at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:606)
at scala.meta.internal.metals.Diagnostics.onBuildPublishDiagnostics(Diagnostics.scala:142)
at scala.meta.internal.metals.clients.language.ForwardingMetalsBuildClient.onBuildPublishDiagnostics(ForwardingMetalsBuildClient.scala:109)
... 16 more
2023.01.05 09:17:27 INFO time: compiled coursier.js[2.12.17] in 8.87s�[0m
2023.01.05 09:17:27 INFO compiling target tests.js[2.12.17].test�[0m
Jan 05, 2023 9:17:56 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
WARNING: Notification threw an exception: {
"jsonrpc": "2.0",
"method": "build/publishDiagnostics",
"params": {
"textDocument": {
"uri": "file:///Users/ckipp/Documents/scala-workspace/coursier-org/coursier/tests/js/2.12.17/test?id\u003dtests.js[2.12.17].test"
},
"buildTarget": {
"uri": "file:///Users/ckipp/Documents/scala-workspace/coursier-org/coursier/tests/js/2.12.17/test?id\u003dtests.js[2.12.17].test"
},
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"severity": 2,
"source": "mill",
"message": "13 deprecations (since 2.1.0-M6); re-run with -deprecation for details"
}
],
"reset": true
}
}
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.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:114)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
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: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.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 12 more
Caused by: java.lang.IllegalArgumentException: URI has a query component
at java.base/sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:58)
at java.base/sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:102)
at java.base/java.nio.file.Path.of(Path.java:203)
at java.base/java.nio.file.Paths.get(Paths.java:98)
at scala.meta.internal.mtags.MtagsEnrichments$XtensionURIMtags.toAbsolutePath(MtagsEnrichments.scala:119)
at scala.meta.internal.mtags.MtagsEnrichments$XtensionStringMtags.toAbsolutePath(MtagsEnrichments.scala:158)
at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:609)
at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:606)
at scala.meta.internal.metals.Diagnostics.onBuildPublishDiagnostics(Diagnostics.scala:142)
at scala.meta.internal.metals.clients.language.ForwardingMetalsBuildClient.onBuildPublishDiagnostics(ForwardingMetalsBuildClient.scala:109)
... 16 more
Jan 05, 2023 9:17:56 AM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleNotification
WARNING: Notification threw an exception: {
"jsonrpc": "2.0",
"method": "build/publishDiagnostics",
"params": {
"textDocument": {
"uri": "file:///Users/ckipp/Documents/scala-workspace/coursier-org/coursier/tests/js/2.12.17/test?id\u003dtests.js[2.12.17].test"
},
"buildTarget": {
"uri": "file:///Users/ckipp/Documents/scala-workspace/coursier-org/coursier/tests/js/2.12.17/test?id\u003dtests.js[2.12.17].test"
},
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"severity": 2,
"source": "mill",
"message": "13 deprecations (since 2.1.0-M6); re-run with -deprecation for details"
},
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"severity": 2,
"source": "mill",
"message": "four feature warnings; re-run with -feature for details"
}
],
"reset": true
}
}
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.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.lsp4j.jsonrpc.TracingMessageConsumer.consume(TracingMessageConsumer.java:114)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
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: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.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException
at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 12 more
Caused by: java.lang.IllegalArgumentException: URI has a query component
at java.base/sun.nio.fs.UnixUriUtils.fromUri(UnixUriUtils.java:58)
at java.base/sun.nio.fs.UnixFileSystemProvider.getPath(UnixFileSystemProvider.java:102)
at java.base/java.nio.file.Path.of(Path.java:203)
at java.base/java.nio.file.Paths.get(Paths.java:98)
at scala.meta.internal.mtags.MtagsEnrichments$XtensionURIMtags.toAbsolutePath(MtagsEnrichments.scala:119)
at scala.meta.internal.mtags.MtagsEnrichments$XtensionStringMtags.toAbsolutePath(MtagsEnrichments.scala:158)
at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:609)
at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:606)
at scala.meta.internal.metals.Diagnostics.onBuildPublishDiagnostics(Diagnostics.scala:142)
at scala.meta.internal.metals.clients.language.ForwardingMetalsBuildClient.onBuildPublishDiagnostics(ForwardingMetalsBuildClient.scala:109)
... 16 more
2023.01.05 09:17:56 INFO time: compiled tests.js[2.12.17].test in 28s�[0m
2023.01.05 09:17:56 INFO compiling target env[2.13.6]�[0m
2023.01.05 09:17:56 INFO time: compiled env[2.13.6] in 0.4s�[0m
2023.01.05 09:17:56 INFO compiling target jvm[2.13.6]�[0m
2023.01.05 09:17:59 INFO time: compiled jvm[2.13.6] in 3.3s�[0m
2023.01.05 09:17:59 INFO compiling target launcher[2.13.6]�[0m
2023.01.05 09:18:02 INFO time: compiled launcher[2.13.6] in 2.02s�[0m
2023.01.05 09:18:02 INFO compiling target install[2.13.6]�[0m
2023.01.05 09:18:14 INFO time: compiled install[2.13.6] in 12s�[0m
2023.01.05 09:18:14 INFO compiling target install[2.13.6].test�[0m
2023.01.05 09:18:14 INFO time: compiled install[2.13.6].test in 0.57s�[0m
2023.01.05 09:18:56 INFO compiling target install[2.12.17]�[0m
2023.01.05 09:19:02 INFO time: compiled install[2.12.17] in 5.47s�[0m
2023.01.05 09:23:49 INFO compiling target install[2.12.17].test�[0m
2023.01.05 09:23:49 INFO time: compiled install[2.12.17].test in 0.39s�[0m
However after the exception it makes it think that everything compiled fine.
It gets more confusing when you look in the Doctor as it's showing there are no build targets even though I get messages about compiling certain build targets.
## Metals Info
- Metals Server version: 0.11.10+11-8dc6b6fd-SNAPSHOT
- Build server currently being used is mill-bsp v0.10.10.
- Metals Java: 17.0.5 from Eclipse Adoptium located at /Users/ckipp/.sdkman/candidates/java/17.0.5-tem
These are the installed build targets for this workspace. One build target corresponds to one classpath. For example, normally one sbt project maps to two build targets: main and test.
## Build Targets
## Explanations
### Compilation status:
✅ - code is compiling
### Diagnostics:
✅ - diagnostics correctly being reported by the build server
### Interactive features (completions, hover):
✅ - supported Scala version
### Semanticdb features (references, renames, go to implementation):
✅ - build tool automatically creating needed semanticdb files
### Debugging (run/test, breakpoints, evaluation):
✅ - users can run or test their code with debugging capabilities
### Java Support:
✅ - working non-interactive features (references, rename etc.)
Looking in the BSP logs there are also some Internal Errors that are happening:
After playing around and trying to fix it with clean compiles I was then able to see this error in the Metals logs:
Exception in thread "metals-watch-callback-thread" java.nio.file.NoSuchFileException: /Users/ckipp/Documents/scala-workspace/coursier-org/coursier/out/cache/jvm/2.13.6/test/sources.dest/CustomLoaderClasspath.scala
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
at java.base/java.nio.file.Files.newByteChannel(Files.java:432)
at java.base/java.nio.file.Files.readAllBytes(Files.java:3288)
at scala.meta.internal.io.PlatformFileIO$.slurp(PlatformFileIO.scala:45)
at scala.meta.internal.io.FileIO$.slurp(FileIO.scala:24)
at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$onChange$1(MetalsLanguageServer.scala:1502)
at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$onChange$1$adapted(MetalsLanguageServer.scala:1501)
at scala.collection.immutable.List.foreach(List.scala:333)
at scala.meta.internal.metals.MetalsLanguageServer.onChange(MetalsLanguageServer.scala:1501)
at scala.meta.internal.metals.MetalsLanguageServer.didChangeWatchedFiles(MetalsLanguageServer.scala:1481)
at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$fileWatcher$3(MetalsLanguageServer.scala:222)
at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$fileWatcher$3$adapted(MetalsLanguageServer.scala:222)
at scala.meta.internal.metals.watcher.FileWatcher$$anon$1.loop(FileWatcher.scala:190)
at scala.meta.internal.metals.watcher.FileWatcher$$anon$1.run(FileWatcher.scala:194)
While some of this might need to be addressed on the Mill side, it brings up a good question of how do we handle it when the server is throwing Internal Errors. Right now in Metals there is really no notification that something is going wrong. That's the actual key issue to focus on here. Metals seems to have gotten in a state where it doesn't really think there are any build targets and therefore no functionality is working, but from the user side they have no idea why nothing is working unless they dig into the logs. I think if we get into a state similiar to this there needs to be a way that we notify the user that:
Hey something is super messed up
Here is a way you might be able to fix it
I think in a situation like this it's a common occurrence for the user to just nuke the .bsp/, .bloop/, .metals/ dir here and start over.
Expected behavior
I expect Metals to notify the user that something is borked and give useful information on how to address it.
Operating system
macOS
Editor/Extension
Nvim (nvim-metals)
Version of Metals
0.11.10+14-1ea955ec-SNAPSHOT
Extra context or search terms
No response
The text was updated successfully, but these errors were encountered:
tgodzik
added
bug
Something that is making a piece of functionality unusable
tech debt
We should have addressed this yesterday
labels
Jan 5, 2023
I think the biggest issue we have is what also happened with the Windows job, toAbsolutePath can fail and we don't treat it as an option. But changing that would be a lot of work I'm afraid.
Alternatively, we can at least try to handle the stack traces that you managed to get as a start.
Describe the bug
This will be a bit hard to explain/reproduce, but I still thought it was worth creating an issue for and I can try to dig in further, but it seems that at times when you open a repo that you've already had open before in the past and try to get coding certain BSP requests might fail leaving you in state where Metals doesn't really show you any errors, but nothing is working. Part of this is the BSP server failing, but I also think we can do a better job on the Metals side trying to detect these situations and providing useful information about how to address the issue.
Here is the situation I just hit on. I had worked on the coursier code base on the main branch, but this morning I checked out a pr and just opened the codebase. I had been using mill-bsp so that was being used again. Nothing errored out on me on the user side, but also nothing worked after the indexing finished. No hovers, no goto definitions, nothing. So seemingly no PC or semanticdb features were working. Looking at the metals logs there is an exception that was thrown, but never surfaced.
However after the exception it makes it think that everything compiled fine.
It gets more confusing when you look in the Doctor as it's showing there are no build targets even though I get messages about compiling certain build targets.
Looking in the BSP logs there are also some
Internal Error
s that are happening:After playing around and trying to fix it with clean compiles I was then able to see this error in the Metals logs:
While some of this might need to be addressed on the Mill side, it brings up a good question of how do we handle it when the server is throwing Internal Errors. Right now in Metals there is really no notification that something is going wrong. That's the actual key issue to focus on here. Metals seems to have gotten in a state where it doesn't really think there are any build targets and therefore no functionality is working, but from the user side they have no idea why nothing is working unless they dig into the logs. I think if we get into a state similiar to this there needs to be a way that we notify the user that:
I think in a situation like this it's a common occurrence for the user to just nuke the
.bsp/
,.bloop/
,.metals/
dir here and start over.Expected behavior
I expect Metals to notify the user that something is borked and give useful information on how to address it.
Operating system
macOS
Editor/Extension
Nvim (nvim-metals)
Version of Metals
0.11.10+14-1ea955ec-SNAPSHOT
Extra context or search terms
No response
The text was updated successfully, but these errors were encountered: