Cannot Unmarshall Seq[String] Outside Trait File

I have a route that successfully uses complete after onSuccess to transform a Seq[GeneratedMessage] to Seq[String].

                onSuccess(
                  handler.func(...)
                ) { dataSeq =>
                  complete(
                    dataSeq.map(_.customPrint)
                  )
                }

However when I move the route to a function designed to replicate the route in its & other places, I get an IDE error saying Cannot resolve overloaded method 'complete'. I also get compiler error saying

found   : Seq[String]
[error]  required: akka.http.scaladsl.marshalling.ToResponseMarshallable

I’m not really sure what else to provide here… originally I was inside other Routes inside a trait which extends ErrorAccumulatingCirceSupport with StrictLogging. Now I am in a simple object. But I don’t think expect of those things would have anything to do with this… the function that turns the GeneratedMessage into String is passed in now as a parameter to a def in the object I created, but all it does is call a custom helper function on GeneratedMessage that I wasn’t able to call inside my def due to type erasure…

                onSuccess(
                  handlerFunc(...)
                ) { dataSeq =>
                  complete(
                    dataSeq.map(completeFunc)
                  )
                }

where completeFunc is a paramater passed in as {data => data.customPrint} and handlerFunc is also a parameter passed in as handler.func.

Essentially I built the function in the file it was originally in and the copy-pasted to a common object that I can use in other places. It was working fine within the original file. Now, it doesn’t seem to want to transform my Seq[String] to toResponseMarshallable.

I was able to avoid the error by passing the complete statement into the object function as a parameter. But this is not quite ideal, and I am still wondering why I can’t unmarshall Seq in some places but can in others.

Perhaps you could try looking at the desugared original code to see where the implicit used to come from? Either using the compiler directly with something like scalac -print code.scala or if in IntelliJ View > Show Implicit Hints.