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

Compiler error when trying to use guardrail with Scala metals #1998

Open
Russoul opened this issue Jul 12, 2024 · 2 comments
Open

Compiler error when trying to use guardrail with Scala metals #1998

Russoul opened this issue Jul 12, 2024 · 2 comments

Comments

@Russoul
Copy link

Russoul commented Jul 12, 2024

Scala metals installs a plugin to the workspace automatically. Once installed and the project uses guardrail I get:

ERROR java.lang.NoClassDefFoundError: scala/meta/internal/trees/Syntactic$Term$Apply$

when trying to compile the project

Full stack trace:

2024.07.12 17:48:35 ERROR java.lang.NoClassDefFoundError: scala/meta/internal/trees/Syntactic$Term$Apply$
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$15(Http4sServerGenerator.scala:865)
        at dev.guardrail.TargetValue.map(Target.scala:104)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$14(Http4sServerGenerator.scala:757)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$13(Http4sServerGenerator.scala:756)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$11(Http4sServerGenerator.scala:755)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$10(Http4sServerGenerator.scala:753)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$9(Http4sServerGenerator.scala:752)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$8(Http4sServerGenerator.scala:750)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$7(Http4sServerGenerator.scala:749)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$6(Http4sServerGenerator.scala:747)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$5(Http4sServerGenerator.scala:746)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$4(Http4sServerGenerator.scala:745)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$3(Http4sServerGenerator.scala:744)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$2(Http4sServerGenerator.scala:743)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.$anonfun$generateRoute$1(Http4sServerGenerator.scala:740)
        at cats.data.Chain$.$anonfun$traverseViaChain$3(Chain.scala:1015)
        at cats.Eval$.loop$1(Eval.scala:338)
        at cats.Eval$.cats$Eval$$evaluate(Eval.scala:384)
        at cats.Eval$FlatMap.value(Eval.scala:305)
        at cats.data.Chain$.traverseViaChain(Chain.scala:1037)
        at cats.instances.ListInstances$$anon$1.traverse(list.scala:130)
        at cats.instances.ListInstances$$anon$1.traverse(list.scala:40)
        at cats.Traverse$Ops.traverse(Traverse.scala:201)
        at cats.Traverse$Ops.traverse$(Traverse.scala:200)
        at cats.Traverse$ToTraverseOps$$anon$3.traverse(Traverse.scala:230)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.generateRoutes(Http4sServerGenerator.scala:139)
        at dev.guardrail.generators.scala.http4s.Http4sServerGenerator.generateRoutes(Http4sServerGenerator.scala:62)
        at dev.guardrail.generators.ServerGenerator$.$anonfun$fromSwagger$22(ServerGenerator.scala:86)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.generators.ServerGenerator$.$anonfun$fromSwagger$12(ServerGenerator.scala:57)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.generators.ServerGenerator$.$anonfun$fromSwagger$10(ServerGenerator.scala:55)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.generators.ServerGenerator$.$anonfun$fromSwagger$3(ServerGenerator.scala:54)
        at cats.data.Chain$.$anonfun$traverseViaChain$1(Chain.scala:1009)
        at cats.Later.value$lzycompute(Eval.scala:169)
        at cats.Later.value(Eval.scala:168)
        at cats.Eval$.loop$1(Eval.scala:359)
        at cats.Eval$.cats$Eval$$evaluate(Eval.scala:384)
        at cats.Eval$FlatMap.value(Eval.scala:305)
        at cats.data.Chain$.traverseViaChain(Chain.scala:1037)
        at cats.instances.ListInstances$$anon$1.traverse(list.scala:130)
        at cats.instances.ListInstances$$anon$1.traverse(list.scala:40)
        at cats.Traverse$Ops.traverse(Traverse.scala:201)
        at cats.Traverse$Ops.traverse$(Traverse.scala:200)
        at cats.Traverse$ToTraverseOps$$anon$3.traverse(Traverse.scala:230)
        at dev.guardrail.generators.ServerGenerator$.$anonfun$fromSwagger$2(ServerGenerator.scala:45)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.generators.ServerGenerator$.$anonfun$fromSwagger$1(ServerGenerator.scala:44)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.generators.ServerGenerator$.fromSwagger(ServerGenerator.scala:43)
        at dev.guardrail.Common$.$anonfun$prepareDefinitions$33(Common.scala:99)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.Common$.$anonfun$prepareDefinitions$30(Common.scala:85)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.Common$.$anonfun$prepareDefinitions$27(Common.scala:81)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.Common$.$anonfun$prepareDefinitions$26(Common.scala:80)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.Common$.$anonfun$prepareDefinitions$25(Common.scala:79)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.Common$.$anonfun$prepareDefinitions$24(Common.scala:78)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.Common$.$anonfun$prepareDefinitions$23(Common.scala:77)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap$Ops.flatMap(FlatMap.scala:244)
        at cats.FlatMap$Ops.flatMap$(FlatMap.scala:244)
        at cats.FlatMap$ToFlatMapOps$$anon$2.flatMap(FlatMap.scala:258)
        at dev.guardrail.Common$.prepareDefinitions(Common.scala:42)
        at dev.guardrail.core.CoreTermInterp.$anonfun$processArgSet$17(CoreTermInterp.scala:135)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.core.CoreTermInterp.$anonfun$processArgSet$16(CoreTermInterp.scala:133)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.core.CoreTermInterp.$anonfun$processArgSet$15(CoreTermInterp.scala:132)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.core.CoreTermInterp.$anonfun$processArgSet$14(CoreTermInterp.scala:131)
        at dev.guardrail.ReadSwagger$.$anonfun$readSwagger$4(ReadSwagger.scala:25)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.ReadSwagger$.readSwagger(ReadSwagger.scala:25)
        at dev.guardrail.runner.GuardrailRunner.$anonfun$guardrailRunner$3(GuardrailRunner.scala:18)
        at cats.data.Chain$.$anonfun$traverseViaChain$3(Chain.scala:1015)
        at cats.Eval$.loop$1(Eval.scala:362)
        at cats.Eval$.cats$Eval$$evaluate(Eval.scala:384)
        at cats.Eval$Defer.value(Eval.scala:283)
        at cats.FlatMap.$anonfun$map2Eval$1(FlatMap.scala:117)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:38)
        at dev.guardrail.Target$$anon$1.flatMap(Target.scala:29)
        at cats.FlatMap.map2Eval(FlatMap.scala:117)
        at cats.FlatMap.map2Eval$(FlatMap.scala:116)
        at dev.guardrail.Target$$anon$1.map2Eval(Target.scala:29)
        at cats.data.Chain$.$anonfun$traverseViaChain$3(Chain.scala:1015)
        at cats.Eval$.loop$1(Eval.scala:338)
        at cats.Eval$.cats$Eval$$evaluate(Eval.scala:384)
        at cats.Eval$FlatMap.value(Eval.scala:305)
        at cats.data.Chain$.traverseViaChain(Chain.scala:1037)
        at cats.instances.ListInstances$$anon$1.traverse(list.scala:130)
        at cats.instances.ListInstances$$anon$1.traverse(list.scala:40)
        at cats.Traverse.flatTraverse(Traverse.scala:89)
        at cats.Traverse.flatTraverse$(Traverse.scala:88)
        at cats.instances.ListInstances$$anon$1.flatTraverse(list.scala:40)
        at cats.Traverse$Ops.flatTraverse(Traverse.scala:205)
        at cats.Traverse$Ops.flatTraverse$(Traverse.scala:204)
        at cats.Traverse$ToTraverseOps$$anon$3.flatTraverse(Traverse.scala:230)
        at dev.guardrail.runner.GuardrailRunner.$anonfun$guardrailRunner$2(GuardrailRunner.scala:16)
        at dev.guardrail.TargetValue.flatMap(Target.scala:103)
        at dev.guardrail.runner.GuardrailRunner.$anonfun$guardrailRunner$1(GuardrailRunner.scala:16)
        at dev.guardrail.sbt.Tasks$.guardrailTask(Tasks.scala:38)
        at dev.guardrail.sbt.AbstractGuardrailPlugin.$anonfun$cachedGuardrailTask$4(AbstractCodegenPlugin.scala:203)
        at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:81)
        at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:154)
        at sbt.util.Difference.apply(Tracked.scala:415)
        at sbt.util.Difference.apply(Tracked.scala:395)
        at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:150)
        at sbt.util.Difference.apply(Tracked.scala:415)
        at sbt.util.Difference.apply(Tracked.scala:390)
        at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:149)
        at dev.guardrail.sbt.AbstractGuardrailPlugin.cachedGuardrailTask(AbstractCodegenPlugin.scala:207)
        at dev.guardrail.sbt.AbstractGuardrailPlugin.$anonfun$scopedSettings$5(AbstractCodegenPlugin.scala:217)
        at scala.Function1.$anonfun$compose$1(Function1.scala:49)
        at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
        at sbt.std.Transform$$anon$4.work(Transform.scala:69)
        at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
        at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
        at sbt.Execute.work(Execute.scala:292)
        at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
        at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        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)

@blast-hardcheese
Copy link
Member

I'll publish a new version with the latest scala.metals version

@Russoul
Copy link
Author

Russoul commented Jul 15, 2024

Thanks! Could it be in the next 0.75.X release? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants