code-server: [Bug]: Scala[Metals] would report "failed to connect with build server."

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Edge
  • Local OS: Windows 10
  • Remote OS: Ubuntu 18
  • Remote Architecture: x86_64
  • code-server --version: 4.4.0

Steps to Reproduce

  1. open code-server
  2. install Scala[Metals] extension.
  3. open a scala project.

Expected

metals works.

Actual

Report “Failed to connect the build server, no functionality will work.”

Logs

The metals would report as below.

2022.06.13 10:58:52 ERROR Failed to connect with build server, no functionality will work.
java.lang.NullPointerException
	at scala.meta.internal.mtags.CommonMtagsEnrichments$XtensionPathMetals.filename(CommonMtagsEnrichments.scala:308)
	at scala.meta.internal.mtags.CommonMtagsEnrichments$XtensionAbsolutePath.filename(CommonMtagsEnrichments.scala:469)
	at scala.meta.internal.metals.JdkSources$.isJdkCandidate$1(JdkSources.scala:37)
	at scala.meta.internal.metals.JdkSources$.$anonfun$candidates$2(JdkSources.scala:47)
	at scala.collection.immutable.List.map(List.scala:246)
	at scala.meta.internal.metals.JdkSources$.candidates(JdkSources.scala:44)
	at scala.meta.internal.metals.JdkSources$.apply(JdkSources.scala:20)
	at scala.meta.internal.metals.doctor.ProblemResolver.javaSourcesProblem$1(ProblemResolver.scala:223)
	at scala.meta.internal.metals.doctor.ProblemResolver.$anonfun$findProblem$5(ProblemResolver.scala:291)
	at scala.Option.orElse(Option.scala:477)
	at scala.meta.internal.metals.doctor.ProblemResolver.findProblem(ProblemResolver.scala:291)
	at scala.meta.internal.metals.doctor.ProblemResolver.$anonfun$problemMessage$1(ProblemResolver.scala:67)
	at scala.collection.immutable.List.flatMap(List.scala:293)
	at scala.meta.internal.metals.doctor.ProblemResolver.problemMessage(ProblemResolver.scala:66)
	at scala.meta.internal.metals.doctor.Doctor.check(Doctor.scala:165)
	at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$connectToNewBuildServer$8(MetalsLanguageServer.scala:2345)
	at scala.meta.internal.metals.Indexer.$anonfun$indexWorkspace$6(Indexer.scala:220)
	at scala.meta.internal.metals.TimerProvider.timedThunk(TimerProvider.scala:25)
	at scala.meta.internal.metals.Indexer.indexWorkspace(Indexer.scala:219)
	at scala.meta.internal.metals.Indexer.$anonfun$profiledIndexWorkspace$2(Indexer.scala:140)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.meta.internal.metals.TimerProvider.timedThunk(TimerProvider.scala:25)
	at scala.meta.internal.metals.Indexer.$anonfun$profiledIndexWorkspace$1(Indexer.scala:140)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:678)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Screenshot/Video

No response

Does this issue happen in VS Code?

  • I cannot reproduce this in VS Code.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

Actually i am not using https now. I just follow the instruction on installation page of documentation, and install code-server through apt on Ubuntu.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

It might be difficult to debug without logs.

I tried this out in an Ubuntu 20.04.4 container but was not able to reproduce:

git clone https://github.com/Readon/SpinalHDL
curl -fsSL https://code-server.dev/install.sh | sh
sudo systemctl start code-server@$USER
  1. Open SpinalHDL in code-server
  2. Click “Import build” once it appears in a popup
  3. See Connected to Build server: Bloop v1.5.0-18-003e6c7b eventually in the output panel

Definitely strange that the systemd version does not work while running directly does. Could you share the systemd file?

I found that if i start the service through “/usr/bin/code-server”, the bloop could work. However, if it is started by “systemctl start code-server@xxxx”, it would fail.