Scala sbt "could not find implicit value" in CI
The compiler needed to supply an implicit argument and could not find a matching one in scope. It reports "could not find implicit value for parameter ...", naming the implicit type it was looking for.
What this error means
sbt compile fails with "[error] could not find implicit value for parameter X: T" or "no implicits found for parameter", pointing at the call that requires the implicit.
[error] /src/main/scala/Json.scala:12:30: could not find implicit value for
[error] evidence parameter of type io.circe.Encoder[User]
[error] val payload = user.asJson
[error] ^Common causes
The required implicit instance is not imported
A typeclass instance (an Encoder, Ordering, ExecutionContext) exists but its providing import is not in scope at the call site.
No instance derives for the concrete type
The library can derive the implicit for some types but not yours, so the compiler finds no candidate to summon.
How to fix it
Bring the implicit into scope
- Read which implicit type the error names.
- Import the instance or its derivation from the providing package.
- Re-run
sbt compileto confirm the implicit resolves.
import io.circe.generic.auto._Provide an explicit instance
When no derivation fits, define the instance yourself so the compiler has a candidate.
implicit val userEncoder: Encoder[User] =
Encoder.forProduct2("id", "name")(u => (u.id, u.name))How to prevent it
- Import typeclass instances explicitly where they are used.
- Define instances for your own types instead of relying on broad auto-derivation.
- Compile locally so missing implicits surface before CI.