Skip to content
Latchkey

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.

sbt output
[error] /src/main/scala/App.scala:4:8: not found: object cats
[error] import cats.syntax.all._
[error]        ^
[error] one error found

Common 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
// build.sbt
libraryDependencies += "org.typelevel" %% "cats-core" % "2.10.0"

Check the symbol path and Scala version

  1. Confirm the package path in the import matches the library.
  2. Ensure the dependency’s cross-version matches your scalaVersion.
  3. Reload sbt (reload) if build.sbt changed but the session is stale.

How to prevent it

  • Use %% so dependencies match your Scala binary version.
  • Keep libraryDependencies in sync with the imports you use.
  • Pin scalaVersion so cross-version artifacts resolve consistently.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →