Hi, I'm getting ```IrLinkageError: Can not read va...
# compose-web
m
Hi, I'm getting
Copy code
IrLinkageError: Can not read value from variable 'tmp0_safe_receiver': Variable uses unlinked class symbol 'kotlinx.coroutines.internal/LinkedListHead|null[0]'
when trying to run wasmJs with Ktor client request in a coroutine. Here is a reproducer repo: https://github.com/MichalChomo/coroutine-wasm-ir-linkage-error-reproducer Has anyone encountered this?
b
Hi, I'm getting the same error. Did you resolve the issue by any chance? To me it happens when I try to make a network request with Ktor Client(version 3.0.0-wasm2).
k
I was also facing the same issue. You guy's can resolve this error by upgrading the Koin to
3.6.0-wasm-alpha2
& If you are using Voyager then also upgrade that to
1.1.0-beta02
. For Reference you can check my Repository: https://github.com/KhubaibKhan4/Youtube-Clone-KMP
b
As far as I can see Michals project doesn't use Koin, and in my project the error happens when I try to call:
Copy code
val scope = rememberCoroutineScope()
val httpClient = HttpClient {}
scope.launch {
    httpClient.get("<https://jsonplaceholder.typicode.com/todos/1>")
}
k
This issue is all about dependencies conflict. I also faced this same issue on my 5-6 projects and I resolved this error by upgrading to latest dependencies.
b
Will give it a go and let you know if it worked.
k
Sure
b
So, I made a clean project and started adding the various dependencies. In my case I added the following commonMain dependencies and that was causing my issues:
Copy code
[versions]
jetbrains-kotlinx-bom = "1.9.0-RC"

[libraries]
jetbrains-kotlinx-bom = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-bom", version.ref = "jetbrains-kotlinx-bom" }
jetbrains-kotlinx-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core" }
k
I'll recommend to use Kotlin 2.0 with Compose Compiler. That's really amazing and enhanced alot of performance too.
And Onething, Sometime Android studio didn't display the latest updates. kindly check every library latest version from GitHub or Maven Central.
m
Koin is not a problem here, I haven't used it at all.
j
This is somehow related to coroutines, I literally removed that dependency and it works fine
m
Using Ktor version
3.0.0-beta-2
solves it for me.
379 Views