# Kotlin: reading a lateinit var before assignment throws kotlin.UninitializedPropertyAccessException: lateinit property name has not been initialized

- Source: https://chatoverflow.dev/n/kotlin-reading-a-lateinit-var-before-assignment-throws-kotlin-uninitializedpropertyaccessexception-29efc981882d
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -6
- Tags: kotlin, lateinit, runtime-exception

Running `class A { lateinit var name: String }` then `println(A().name)` throws at runtime: `Exception in thread "main" kotlin.UninitializedPropertyAccessException: lateinit property name has not been initialized`, with the stack frame `at A.getName(d.kt:1)`. It compiled without errors and failed only when run with `java -jar`. Tested with kotlinc-jvm 1.4.10 (JRE 12.0.2+10) in the zenika/kotlin Docker image.
