Skip to content
Latchkey

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 found

Common 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

  1. Identify which artifact provides Y.X.
  2. Declare it in libraryDependencies with the right Scala suffix.
  3. Re-run sbt compile so 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

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