https://kotlinlang.org logo
#ktor
Title
# ktor
w

wakingrufus

05/17/2021, 12:05 PM
Hi There. what is a good way to approach debugging
Copy code
ClassCastException: kotlin.coroutines.intrinsics.CoroutineSingletons cannot be cast to ...
I am using 
suspend fun
 as well as Flows, but I am not sure where to start with this. I posted in #coroutines but Roman suggested this is probably a ktor-specific problem. stacktrace in 🧵
Copy code
Exception in thread "main" java.lang.ClassCastException: kotlin.coroutines.intrinsics.CoroutineSingletons cannot be cast to io.ktor.client.statement.HttpResponse
        at com.github.wakingrufus.kalibrate.example.MainKt$main$2$4$1$1$1.invoke(Main.kt:68)
        at com.github.wakingrufus.kalibrate.example.MainKt$main$2$4$1$1$1.invoke(Main.kt)
        at com.github.wakingrufus.kalibrate.scenario.Step.invoke(Step.kt:15)
        at com.github.wakingrufus.kalibrate.scenario.StepContainer$invoke$1.invokeSuspend(Simulation.kt:93)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:86)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:61)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at com.github.wakingrufus.kalibrate.scenario.StepContainer.invoke(Simulation.kt:91)
        at com.github.wakingrufus.kalibrate.scenario.Simulation.runSetup(Simulation.kt:75)
        at com.github.wakingrufus.kalibrate.scenario.Simulation$singletonWorkPattern$1$1$1.invokeSuspend(Simulation.kt:25)
        at com.github.wakingrufus.kalibrate.scenario.Simulation$singletonWorkPattern$1$1$1.invoke(Simulation.kt)
        at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
        at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:212)
        at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
        at kotlinx.coroutines.flow.internal.ChannelFlowMerge$collectTo$$inlined$collect$1$lambda$1.invokeSuspend(Merge.kt:69)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:86)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:61)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at com.github.wakingrufus.kalibrate.KalibrateDslBuilder.invoke(KalibrateDsl.kt:92)
        at com.github.wakingrufus.kalibrate.KalibrateDslKt$kalibrate$1.invoke(KalibrateDsl.kt:125)
        at com.github.wakingrufus.kalibrate.KalibrateDslKt$kalibrate$1.invoke(KalibrateDsl.kt)
        at com.xenomachina.argparser.SystemExitExceptionKt.mainBody(SystemExitException.kt:74)
        at com.xenomachina.argparser.SystemExitExceptionKt.mainBody$default(SystemExitException.kt:72)
        at com.github.wakingrufus.kalibrate.KalibrateDslKt.kalibrate(KalibrateDsl.kt:124)
        at com.github.wakingrufus.kalibrate.example.MainKt.main(Main.kt:16)
a

Aleksei Tirman [JB]

05/17/2021, 12:10 PM
Could you please file an issue in YouTrack with a sample project attached?
w

wakingrufus

05/17/2021, 1:43 PM
🙏 1
👍 1
2 Views