Skip to content
Latchkey

sbt "not found: object" / "not found: value"

The Scala compiler reached a name it cannot resolve. The package, class, or value you referenced is not on the compile classpath, or the import is missing.

What this error means

Compilation stops with not found: object Foo or not found: value bar, pointing at the line where the unknown name appears. It is deterministic - the symbol simply is not visible.

sbt
[error] /src/main/scala/App.scala:7:8: not found: object cats
[error] import cats.effect.IO
[error]        ^
[error] one error found

Common causes

The dependency is missing or in the wrong scope

Referencing cats.effect without adding cats-effect to libraryDependencies, or adding it only to Test, leaves the object off the main compile classpath.

Missing import or wrong package path

The symbol exists but is in a package you did not import, or the package name was typed incorrectly.

Generated sources not produced yet

Code that depends on generated sources (protobuf, BuildInfo) fails if the generator task did not run before compile.

How to fix it

Add the dependency in the right scope

Declare the library on the compile classpath so the object resolves.

build.sbt
libraryDependencies += "org.typelevel" %% "cats-effect" % "3.5.4"

Fix the import path

  1. Confirm the fully qualified package of the symbol from its docs.
  2. Add the matching import at the top of the file.
  3. Watch for case typos: Scala identifiers are case sensitive.

Ensure generators run first

Wire generated sources into Compile / sourceGenerators so they exist before compilation.

How to prevent it

  • Keep dependency scopes correct (compile vs test).
  • Let your IDE flag unresolved symbols before pushing.
  • Run sbt clean compile locally on a fresh checkout.

Related guides

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