Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchFileException when opening vscode project #6667

Open
scarf005 opened this issue Aug 11, 2024 · 7 comments
Open

NoSuchFileException when opening vscode project #6667

scarf005 opened this issue Aug 11, 2024 · 7 comments
Assignees
Labels
bug Something that is making a piece of functionality unusable investigation needed

Comments

@scarf005
Copy link
Contributor

not sure how to reproduce it correctly nor what additional info i should provide but to try my best:

  1. clone https://github.com/scarf005/aoc-scala
  2. open vscode
  3. scala-cli warns with NoSuchFileException error.

Expected behaviour:

it doesn't.

Operating system:
Linux

Java version:
17

Editor/extension:
Visual Studio Code v1.92.1

Metals version:
1.3.5

Extra context or search terms:

reports.zip

Workspace information:

  • Scala versions: 3.4.2
  • Build tools: 0. scala-cli
  • Build servers:
    0. scala-cli v1.4.3
  • All build tools in workspace:
@tgodzik
Copy link
Contributor

tgodzik commented Aug 13, 2024

Could you also add the logs in .metals/metals.log? I can't seem to reproduce and the stacktrace seems outdated 🤔

@tgodzik tgodzik added needs more information Use if we need more information for a specific ticket and removed investigation needed labels Aug 13, 2024
@scarf005
Copy link
Contributor Author

metals.log

hope this one's not too outdated

@tgodzik
Copy link
Contributor

tgodzik commented Aug 15, 2024

I don't see NoSuchFileException unfortunately, we do however archive the older logs, so they might be still in .metals

A side note, I see a StackOverflow exception, is it possible for you to share your code?

Could not parse /home/scarf/repo/aoc-scala/2015/Day7.scala, saved the current snapshot to Some(/home/scarf/repo/aoc-scala/.metals/.reports/metals-full/2024-08-11/r_stackoverflow_Day7.scala_(aoc-scala_f4dd477a3a)_17-22-57-245.md)	at scala.meta.internal.parsers.ScalametaParser.tmplDef(ScalametaParser.scala:3605)

it should be in the .reports directory

@scarf005
Copy link
Contributor Author

would it be okay if i zip the entire .metals? i edited the project (and Day7.scala) more after the incident so the reports might have been overwritten

.metals.tar.gz

also below is the metals log from trashbin
metals-3.tar.gz
metals-2.tar.gz
metals-0.tar.gz

@tgodzik
Copy link
Contributor

tgodzik commented Aug 15, 2024

Looks like there are some NoSuchFileException, did /home/scarf/repo/etc/learn/scala/aoc-2015/2015/src/Day1.scala get removed at any point, looks like maybe we were expecting a definition there, but the file got moved, which is why we couldn't find it? Though when a file changes we normally update it, so there might be something off there,

I also saw:

 Notification threw an exception: {
  "jsonrpc": "2.0",
  "method": "metals/didFocusTextDocument",
  "params": [
    "git:/home/scarf/repo/aoc-scala/src/Day1.scala?%7B%22path%22%3A%22%2Fhome%2Fscarf%2Frepo%2Faoc-scala%2Fsrc%2FDay1.scala%22%2C%22ref%22%3A%22HEAD%22%7D"
  ]
}
java.nio.file.FileSystemNotFoundException: Provider "git" not installed
	at java.base/java.nio.file.Path.of(Path.java:212)

and that's correct since we do not handle git filesystem, nor is it handled by JVM normally as far as I know. Could that be somehow related?

I see some issues we might be able to fix thanks to your logs, but the main issue might be though. I can do some workaround though for sure

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable investigation needed and removed needs more information Use if we need more information for a specific ticket labels Aug 15, 2024
@scarf005
Copy link
Contributor Author

scarf005 commented Aug 15, 2024

yes, i changed the file path from src/Day1.scala to 2015/Day1.scala
(project: github.com/scarf005/aoc-scala)

@soronpo
Copy link

soronpo commented Aug 31, 2024

@tgodzik I'm also getting java.nio.file.FileSystemNotFoundException: Provider "git" not installed, and I think I have an easy way to replicate the issue.

First, for the record, this is the error I get:

WARNING: Notification threw an exception: {
  "jsonrpc": "2.0",
  "method": "metals/didFocusTextDocument",
  "params": [
    "git:/c%3A/Users/oronpo/IdeaProjects/dfhdl/lib/src/test/scala/issues/i116.scala?%7B%22path%22%3A%22c%3A%5C%5CUsers%5C%5Coronpo%5C%5CIdeaProjects%5C%5Cdfhdl%5C%5Clib%5C%5Csrc%5C%5Ctest%5C%5Cscala%5C%5Cissues%5C%5Ci116.scala%22%2C%22ref%22%3A%22~%22%7D"
  ]
}
java.nio.file.FileSystemNotFoundException: Provider "git" not installed
	at java.base/java.nio.file.Path.of(Path.java:212)
	at java.base/java.nio.file.Paths.get(Paths.java:98)
	at scala.meta.internal.mtags.MtagsEnrichments$XtensionURIMtags.toAbsolutePath(MtagsEnrichments.scala:130)
	at scala.meta.internal.mtags.MtagsEnrichments$XtensionStringMtags.toAbsolutePath(MtagsEnrichments.scala:187)
	at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:773)
	at scala.meta.internal.metals.MetalsEnrichments$XtensionString.toAbsolutePath(MetalsEnrichments.scala:770)
	at scala.meta.internal.metals.WorkspaceLspService.didFocus(WorkspaceLspService.scala:698)
	at scala.meta.metals.lsp.DelegatingScalaService.didFocus(DelegatingScalaService.scala:43)
	at jdk.internal.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:160)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:231)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:198)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114)
	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:840)

If I click the git:/ link through the log and open the document, metals causes another exception as seen in this recording
persistant

VSCode chooses to open via git:/ link in various situations, so that may trigger the problem.
For you to replicate the issue, just create a git:/my/system/file to file on your local system and you should see metals throwing the exception. The solution should probably be to convert the git:/ link to a normal system file path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable investigation needed
Projects
Status: Triage
Development

No branches or pull requests

3 participants