Codegen Error with arrayOfNulls and Stream.toArray

Hey there, I was developing an application in kotlin, when suddenly it failed to compile and spat out an exceedingly long error. I managed to find out which part of it caused the error, and I was wondering why it would have caused an error.
Here’s the code: