Scala "not found: object/value" in sbt CI
The Scala compiler could not resolve a symbol. "not found: object/value" means a referenced object, value, or package is not on the classpath or not imported - a genuine compile error.
What this error means
Compilation fails with "[error] ... not found: object Foo" or "not found: value bar", pointing at a file and line. It is deterministic; the same source fails identically every time.
[error] /src/main/scala/App.scala:4:8: not found: object cats
[error] import cats.syntax.all._
[error] ^
[error] one error foundCommon causes
Missing import or dependency
The object/value is real but not imported, or the library that provides it is not declared in libraryDependencies, so it is absent from the classpath.
Wrong package path or Scala-version artifact
A typo in the package, or depending on the wrong cross-version artifact (_2.12 vs _2.13/_3), means the symbol is not where the compiler looks.
How to fix it
Add the import and dependency
Declare the library (with the right cross-version) and import the symbol.
// build.sbt
libraryDependencies += "org.typelevel" %% "cats-core" % "2.10.0"Check the symbol path and Scala version
- Confirm the package path in the import matches the library.
- Ensure the dependency’s cross-version matches your
scalaVersion. - Reload sbt (
reload) ifbuild.sbtchanged but the session is stale.
How to prevent it
- Use
%%so dependencies match your Scala binary version. - Keep
libraryDependenciesin sync with the imports you use. - Pin
scalaVersionso cross-version artifacts resolve consistently.