Possible Causes of "Service not found" Error

What can cause "Service not found:" even if the service is provided?:
      Effect.provide(
        Layer.mergeAll(
          Layer.scoped(
            Connection.Connection,
            connectionLive,
          ),
          Layer.effect(
            OtherServiceWhichUseConnectionTag,
            otherServiceLive,
          ),
        ),
        // snip
      ),


The second service is correctly removed from R, but with Connection i get: Type 'Connection' is not assignable to type 'never'..

This is Connection:
interface Connection {
  query: () => Effect.Effect<never, never, Chunk.Chunk<unknown>>;
}

export const Connection = Context.Tag<Connection>("Connection");


This is connectionLive:
function connectionLive(): Effect.Effect<Scope, never, Connection>
Was this page helpful?