E122: Imported Twice
This error is emitted when the same name is imported twice on the same import line.
Each import line should only import a name once. Duplicate imports on the same line are redundant and indicate a likely mistake.
Example
import scala.collection.mutable.{ArrayBuffer, ArrayBuffer}
Error
-- [E122] Syntax Error: example.scala:1:46 -------------------------------------
1 |import scala.collection.mutable.{ArrayBuffer, ArrayBuffer}
| ^^^^^^^^^^^
| ArrayBuffer is imported twice on the same import line.
Solution
// Import each name only once
import scala.collection.mutable.ArrayBuffer
// Or if you need aliases, use different names
import scala.collection.mutable.{ArrayBuffer, ArrayBuffer as MutableBuffer}
In this article