Skip to content
Latchkey

sbt "value X is not a member of Y" in CI

You called a method or accessed a field on a value whose type does not have it. The compiler looked at the receiver type and found no such member.

What this error means

Compilation fails with value foo is not a member of Bar, often suggesting a similarly named member. It is deterministic and points at the call site.

sbt
[error] /src/main/scala/App.scala:8:18: value toJson is not a member of
[error]   scala.collection.immutable.Map[String,Int]
[error]   val out = data.toJson
[error]                  ^

Common causes

Missing extension method or import

The member comes from an extension method or syntax import (a circe/cats syntax package) that is not in scope, so the base type has no such method.

Wrong receiver type

Inference gave the value a wider or different type than you assumed, so the member you expected is not declared on it.

Typo or wrong API version

The method name is misspelled, or a library upgrade renamed or removed the member.

How to fix it

Import the syntax that adds the method

Bring the extension/syntax package into scope so the member resolves.

App.scala
import io.circe.syntax._
val out = data.asJson

Check the receiver type

  1. Hover or annotate the value to confirm its actual type.
  2. Verify the member exists on that type in the library docs.
  3. Adjust the call to a method that the type really declares.

Align with the library version

Confirm the method name matches the version on your classpath; consult the changelog after a dependency bump.

How to prevent it

  • Keep syntax imports consistent across files.
  • Read changelogs before bumping libraries.
  • Let the IDE flag unknown members before pushing.

Related guides

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