Kotlin UninitializedPropertyAccessException: lateinit property has not been initialized
Accessed a `lateinit var` before injection or lifecycle setup assigned it.
Runs locally in browser
Free · No login
Independently Verified 2026-11-25
v4.1.0
Identifier: Kotlin UninitializedPropertyAccessException
Platform: Java
Common Root Causes:
- Accessed a `lateinit var` before injection or lifecycle setup assigned it.
Interactive Diagnostic Checklist
Verified Solutions:
- Prefer constructor injection or `by lazy` over mutable `lateinit var`.
Safe Diagnostic Command:
Check `::prop.isInitialized` or constructor injection
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.
Technical Explanation
Accessed a `lateinit var` before injection or lifecycle setup assigned it. Recommended diagnostic: `Check `::prop.isInitialized` or constructor injection`. Remediation: Prefer constructor injection or `by lazy` over mutable `lateinit var`.
Worked Examples
- Run `Check `::prop.isInitialized` or constructor injection` to verify root cause before applying the remediation.
Limitations & Assumptions
- Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.
Source References & Verification
Resource ID: err-kotlin-uninitializedpropertyaccess · Independently verified: 2026-11-25