I got this error in Scala 3 when using the extension syntax inside a trait. The classes extending that trait cannot be mocked. Changing the syntax to the good old implicit class fixed the issue.
extension
implicit class