Scala 3 migration "Not found: X" in CI
The Scala 3 compiler could not resolve a name that compiled under Scala 2. Common causes are a library that has no Scala 3 build, a moved package, or Scala 2 only syntax the new compiler rejects.
What this error means
A build cross-compiled or migrated to Scala 3 fails with "Not found: X" or "Not found: type X" on names that were fine on 2.13.
[error] -- [E006] Not Found Error: /src/main/scala/App.scala:5:20
[error] 5 | val p = new ProcessBuilder
[error] | ^^^^^^^^^^^^^^
[error] | Not found: type ProcessBuilderCommon causes
A dependency has no Scala 3 artifact
A %% library still only publishes _2.13, so on Scala 3 the module (and its names) do not resolve.
A moved or renamed symbol between versions
A type moved package or a Scala 2 only construct is not available, so the Scala 3 compiler cannot find the name.
How to fix it
Use withDottyCompat or a Scala 3 build of the library
- Check whether the dependency publishes a Scala 3 artifact.
- If yes, upgrade to it; if not, use
.cross(CrossVersion.for3Use2_13)to consume the 2.13 build on Scala 3. - Recompile and fix any remaining moved-symbol imports.
libraryDependencies += ("com.example" %% "lib" % "1.0")
.cross(CrossVersion.for3Use2_13)Run the Scala 3 migration rewrites
The -rewrite -source 3.0-migration flags let scalac auto-fix many Scala 2 to 3 syntax gaps.
scalacOptions ++= Seq("-source", "3.0-migration", "-rewrite")How to prevent it
- Confirm each dependency ships a Scala 3 build before migrating.
- Migrate with
-source 3.0-migrationto surface issues incrementally. - Cross-build 2.13 and 3 together so regressions are caught in CI.