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

org.scalafmt.sbt.ScalafmtSbtReporter$ScalafmtSbtError: scalafmt: [v3.7.16] corrupted class path #3689

Closed
armanbilge opened this issue Nov 11, 2023 · 4 comments · Fixed by #3691

Comments

@armanbilge
Copy link

For example: https://github.com/typelevel/toolkit/actions/runs/6830956374/job/18579714429?pr=122#step:6:25

But this seems to be widespread 🤔

@seveneves
Copy link

The org.scalafmt.interfaces.ScalafmtException: [v3.7.16] corrupted class path: exception is caused by following when running scalafmt cli tool with scalafmt config set to 3.7.16

Caused by: java.lang.ClassNotFoundException: org.scalafmt.config.Config
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:592)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	at org.scalafmt.dynamic.ScalafmtReflect.<init>(ScalafmtReflect.scala:21)
	at org.scalafmt.dynamic.ScalafmtModuleLoader$.$anonfun$loadClassPath$1(ScalafmtModuleLoader.scala:73)
	at scala.util.Try$.apply(Try.scala:210)
	at org.scalafmt.dynamic.ScalafmtModuleLoader$.org$scalafmt$dynamic$ScalafmtModuleLoader$$loadClassPath(ScalafmtModuleLoader.scala:71)
	at org.scalafmt.dynamic.ScalafmtModuleLoader$WithDownloader.$anonfun$load$2(ScalafmtModuleLoader.scala:37)
	at scala.util.Success.fold(Try.scala:281)
	at org.scalafmt.dynamic.ScalafmtModuleLoader$WithDownloader.load(ScalafmtModuleLoader.scala:37)
	at org.scalafmt.dynamic.ScalafmtModuleLoader$CachedProxy.load$1(ScalafmtModuleLoader.scala:56)
	at org.scalafmt.dynamic.ScalafmtModuleLoader$CachedProxy.$anonfun$load$3(ScalafmtModuleLoader.scala:57)
	at scala.util.Try$.apply(Try.scala:210)
	at org.scalafmt.dynamic.utils.ReentrantCache.getOrAddToCache(ReentrantCache.scala:41)
	at org.scalafmt.dynamic.ScalafmtModuleLoader$CachedProxy.load(ScalafmtModuleLoader.scala:57)
	at org.scalafmt.dynamic.ScalafmtConfigLoader$.$anonfun$load$1(ScalafmtConfigLoader.scala:34)
	at scala.util.Either.flatMap(Either.scala:352)
	at org.scalafmt.dynamic.ScalafmtConfigLoader$.load(ScalafmtConfigLoader.scala:32)
	at org.scalafmt.dynamic.ScalafmtConfigLoader$CachedProxy.load$1(ScalafmtConfigLoader.scala:74)
	at org.scalafmt.dynamic.ScalafmtConfigLoader$CachedProxy.$anonfun$load$12(ScalafmtConfigLoader.scala:76)
	at scala.util.Try$.apply(Try.scala:210)
	at org.scalafmt.dynamic.utils.ReentrantCache.getOrAddToCache(ReentrantCache.scala:41)
	at org.scalafmt.dynamic.ScalafmtConfigLoader$CachedProxy.$anonfun$load$7(ScalafmtConfigLoader.scala:76)
	at scala.util.Success.fold(Try.scala:281)
	at org.scalafmt.dynamic.ScalafmtConfigLoader$CachedProxy.load(ScalafmtConfigLoader.scala:70)
	at org.scalafmt.dynamic.ScalafmtDynamic.resolveConfig(ScalafmtDynamic.scala:59)
	at org.scalafmt.dynamic.ScalafmtDynamic.createSession(ScalafmtDynamic.scala:53)
	at org.scalafmt.cli.ScalafmtDynamicRunner$.run(ScalafmtDynamicRunner.scala:28)

@erikerlandson
Copy link

yeah scala steward upgraded this and it broke my CI

@seveneves
Copy link

The org.scalafmt.interfaces.ScalafmtException: [v3.7.16] corrupted class path: exception is caused by following when running scalafmt cli tool with scalafmt config set to 3.7.16

Updating scalafmt cli tool to the same version 3.7.16 as config file fixed the problem. I assume similar "update" would fix the sbt plugin, which just reports corrupted class path.

The issue seems to be related to the removal/renaming of org.scalafmt.config.Config.

@xuwei-k
Copy link
Contributor

xuwei-k commented Nov 13, 2023

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

Successfully merging a pull request may close this issue.

4 participants