Skip to content
Latchkey

sbt "object X is not a member of package Y" in CI

The Scala compiler found the package but not the object you imported from it. The dependency that provides that object is either missing from the classpath in CI or resolved to a version that no longer contains it.

What this error means

scalac fails with "object X is not a member of package Y" on an import line, even though the code compiles locally.

scalac
[error] /src/main/scala/App.scala:3:19: object circe is not a member of package io
[error] import io.circe.parser._
[error]                   ^

Common causes

The providing dependency is not declared

The import needs a library that is present in your local Ivy cache but never listed in libraryDependencies, so CI compiles without it.

A version mismatch removed or moved the object

CI resolved a different version of the library in which the object was renamed, split into another artifact, or removed.

How to fix it

Declare the dependency that provides the object

  1. Identify which library exports the package in the error.
  2. Add it to libraryDependencies with %%.
  3. Run sbt update then sbt compile.
build.sbt
libraryDependencies += "io.circe" %% "circe-parser" % "0.14.6"

Pin the version that still defines it

If the object moved between releases, pin the version that still exports it or update the import to its new location.

build.sbt
libraryDependencies += "io.circe" %% "circe-core" % "0.14.6"

How to prevent it

  • Declare every import source explicitly rather than relying on transitive luck.
  • Lock dependency versions so the class surface is stable in CI.
  • Run a clean sbt compile locally before pushing to catch missing deps.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →