Skip to content
Latchkey

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

The compiler resolved the receiver's type but that type has no member with the name you called. In CI this is usually a different dependency version, a missing extension-method import, or an implicit that is not in scope.

What this error means

scalac fails with "value X is not a member of Y" (for example a method the type does not declare) at the call site.

scalac
[error] /src/main/scala/Service.scala:20:14: value asJson is not a member of MyCase
[error]     payload.asJson
[error]              ^

Common causes

A missing extension-method import

Methods added by a library (like asJson) come from an implicit or extension that must be imported; without the import the base type has no such member.

A version skew changed the API

CI resolved a version of the library where the method was renamed or removed, so the member no longer exists.

How to fix it

Import the extension that adds the member

  1. Find which import brings the method into scope.
  2. Add that import to the file.
  3. Recompile to confirm the member resolves.
App.scala
import io.circe.syntax._ // adds .asJson
payload.asJson

Align the dependency version with the code

If the method exists only in a specific version, pin that version so CI resolves the same API you compiled against locally.

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

How to prevent it

  • Keep extension-method imports next to the code that uses them.
  • Lock dependency versions so the member surface matches locally and in CI.
  • Review API changes in dependency release notes before upgrading.

Related guides

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