Scala sbt "object X is not a member of package Y" in CI
scalac resolved the package but found no member with that name inside it. The import path is wrong, or the dependency that defines the object is missing from the compile classpath.
What this error means
sbt compile fails with "[error] object X is not a member of package Y" on an import line, often after a dependency version change reorganized packages.
scala
[error] /src/main/scala/Run.scala:3:8: object circe is not a member of package io
[error] import io.circe.syntax._
[error] ^
[error] one error foundCommon causes
The dependency is not on the compile classpath
The package exists in a library that is not declared in libraryDependencies, so the import target is absent.
A version moved or renamed the package
An upgrade relocated the object to a new package path, so the old import no longer points at it.
How to fix it
Add the library that defines the package
- Identify which artifact provides
Y.X. - Declare it in
libraryDependencieswith the right Scala suffix. - Re-run
sbt compileso the import resolves.
build.sbt
libraryDependencies += "io.circe" %% "circe-core" % "0.14.6"Update the import to the new package path
When an upgrade moved the object, change the import to match the new location.
How to prevent it
- Declare every package-providing library explicitly.
- Check release notes for package moves when upgrading.
- Use
%%so the correct cross-built artifact is selected.
Related guides
Scala sbt "not found: value/object X" in CIFix Scala "[error] not found: value X" or "not found: object X" in CI - the compiler reached an identifier it…
Scala sbt "Conflicting cross-version suffixes" (_2.12 vs _2.13) in CIFix Scala sbt "Conflicting cross-version suffixes in: org:name _2.12, _2.13" in CI - two dependencies pull th…
Scala sbt "ResolveException: unresolved dependency" in CIFix Scala sbt "sbt.librarymanagement.ResolveException: Error downloading / unresolved dependency" in CI - the…