@PropertyValue from one module not visible to @Property in another module — MissingPropertyException
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- kotlin
- Domain
- build-system, tooling
Research direction
Start with the compiler-plugin processing for @PropertyValue and @Property across the separate Module A and Module B compilation units; the runtime failure is reported at org.koin.core.scope.Scope.getProperty (Scope.kt:430). Reproduce the shown startKoin setup and confirm completion when the cross-module value resolves without MissingPropertyException, while preserving the documented properties() workaround.
Written by the indexing model from the issue text.
Description
Environment
- Koin BOM: 4.2.1
- Koin Annotations Compiler Plugin: 1.0.0-RC1
- Project type: Kotlin Multiplatform (shared module) + Android (app module)
Description
@PropertyValue declared in one module is not resolved by @Property in another module, causing MissingPropertyException at runtime.
Minimal reproducible example
Module A (shared, KMP commonMain):
class Greeting(val message: String)
@Module
@ComponentScan
@Configuration
class ModuleA {
@Single
fun greeting(
@Property("host") host: String,
): Greeting = Greeting("Hello from $host")
}
Module B (app, Android):
@Module(includes = [ModuleA::class])
@ComponentScan
@Configuration
class ModuleB
@PropertyValue("host")
val host = "https://example.com"
Initialization:
fun main() {
startKoin {
modules(ModuleB::class)
}
val greeting = getKoin().get<Greeting>()
println(greeting.message) // crashes
}
Crash
MissingPropertyException: Property 'host' not found
at org.koin.core.scope.Scope.getProperty(Scope.kt:430)
Expected behavior
@PropertyValue("host") in Module B registers the value globally, making it available to @Property("host") in Module A.
Actual behavior
The property is not found at resolution time. It appears that @PropertyValue annotations are only processed within the compilation unit where they are declared. Since Module A and Module B are separate Gradle modules (separate KSP/compiler plugin runs), the generated code for Module A has no knowledge of the property values declared in Module B.
Also tried
Annotating the parameter with @Provided in Module A to signal it will be supplied externally:
@Single
fun greeting(
@Provided @Property("host") host: String,
): Greeting = Greeting("Hello from $host")
This did not resolve the issue — same MissingPropertyException.
Workaround
Pass properties explicitly via properties() in startKoin:
startKoin {
properties(mapOf("host" to "https://example.com"))
modules(ModuleB::class)
}
Notes
@PropertyValueworks correctly when declared in the same module/compilation unit as the@Propertyconsumer.- The issue is specific to cross-module usage where each module is a separate Gradle module with its own KSP processing.
- Dominant language
- Kotlin
- Stars
- 82
- Forks
- 15
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from InsertKoinIO/koin-compiler-plugin
-
type:improvement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
InsertKoinIO/koin-compiler-plugin#110 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
InsertKoinIO/koin-compiler-plugin#107 · 2 reactions ·
All issues in InsertKoinIO/koin-compiler-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Good First Issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ankidroid/Anki-Android#21942 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
libre-tube/LibreTube#8781 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
MetrolistGroup/Metrolist#4396 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100