The crash report says lateinit property user has not been initialized, and the line it points at looks perfectly reasonable. That gap between “looks fine” and “compiles but fails at runtime” is where most early Kotlin trouble lives. Seven mistakes sit inside that gap, and each one has a specific fix that is easy to recognise once you have seen the shape.
Nullability and late initialization
The double-bang operator is the loudest one. Writing value!! tells the compiler to trust you, and when the trust is misplaced the exception arrives far from the code that caused it. The alternative is usually smaller than it feels: handle the null with ?:, restructure with let, or accept a nullable parameter and return a default.
lateinit is the second version of the same problem. It is appropriate for something a framework injects before use, and wrong for a value that could simply be passed into the constructor. Any lateinit property should have an obvious answer to “who sets this, and when”, or it should not be a lateinit at all.
Collections, copies and mutability
A function that accepts a MutableList and hands it back lets every caller change the object behind your back. Exposing a read-only List in the signature and keeping the mutable version private is a one-word change that removes a whole class of surprise.
The related trap is assuming a copied data class is a deep copy. copy() duplicates the top-level object and shares every nested list or object with the original, so editing one appears to edit the other. When a copy is really needed, copy the pieces too and say so in the function name.
Coroutines and cancellation
Launching work in a global scope keeps it alive after the screen or request that started it is gone, which is how background tasks outlive their purpose and crash on a dead reference. Tie coroutines to a lifecycle or to the surrounding scope, and let structured concurrency do the cleanup.
The subtler mistake is catching Exception around a suspending call and swallowing the cancellation that arrives with it. Rethrowing CancellationException, or catching specific exceptions instead, keeps cancellation working while still handling real errors.
Java habits that Kotlin makes unnecessary
Getters, setters, builder classes and static utility holders are not wrong, they are just already provided. A data class replaces the boilerplate for value objects; default and named arguments replace most builders; top-level functions replace the utility class. Reaching for the old shape makes the code longer without making it clearer, and it hides the Kotlin features you are trying to learn.
Fix the nullability habits first, because they produce the crashes; the rest become obvious as the code gets shorter. Every one of these has the same resolution path — make the compiler carry the guarantee instead of your memory.