# Can't inject CoroutineScope into light service constructors

**URL:** <https://platform.jetbrains.com/t/cant-inject-coroutinescope-into-light-service-constructors/2310>\
**Category:** IntelliJ Platform\
**Created:** [July 21, 2025, 5:06pm UTC](https://platform.jetbrains.com/t/cant-inject-coroutinescope-into-light-service-constructors/2310 "2025-07-21T17:06:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![picimako](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/picimako/32/171_2.png) [@picimako](https://platform.jetbrains.com/u/picimako)\
**Post date:** [July 21, 2025, 5:06pm UTC](https://platform.jetbrains.com/t/cant-inject-coroutinescope-into-light-service-constructors/2310/1 "2025-07-21T17:06:12Z")

</div>

Hi!

I’m trying to move the execution of some stuff inside a coroutine, and for that I’d like to use a `CoroutineScope` injected into a light service constructor as mentioned here: [Launching Coroutines | IntelliJ Platform Plugin SDK](https://plugins.jetbrains.com/docs/intellij/launching-coroutines.html#launching-coroutine-from-service-scope)

However, when I invoke the instantiation of my service, I receive the following message:

```auto
2025-07-21 18:50:11,549 [85435] WARN - #c.i.s.ComponentManagerImpl - Class 'class com.my.project.MyService' does not define any of supported signatures '[(Project)void, (Project,CoroutineScope)void, (CoroutineScope)void, ()void]'
com.intellij.platform.instanceContainer.instantiation.InstantiationException: Class 'class com.my.project.MyService' does not define any of supported signatures '[(Project)void, (Project,CoroutineScope)void, (CoroutineScope)void, ()void]'
	at com.intellij.platform.instanceContainer.instantiation.InstantiateKt.findConstructor(instantiate.kt:64)
	at com.intellij.platform.instanceContainer.instantiation.InstantiateKt.instantiate(instantiate.kt:32)

```

After some debugging I can see the more specific exception that is an `IllegalAccessException` with:

```auto
detailMessage: "no such constructor: com.my.project.MyService.<init>(Project,CoroutineScope)void/invokeSpecial"
cause: "java.lang.LinkageError: bad method type alias: (Project,CoroutineScope)void not visible from class com.my.project.MyService"

```

I get this error with both project- and application-level services, and only if the `CoroutineScope` argument is added, and with as simple of a service as this:

```kotlin
@Service
class MyService(private val cs: CoroutineScope)

```

I haven’t been able to find information or example if any specific configuration, dependency, etc. should be added to the project in order to make this injection work, so I’m stuck here.

Has anyone run in this before? I’d appreciate any insight. Thank you!

---

<div class="post-metadata">

**Author:** ![jansorg](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/jansorg/32/52_2.png) [@jansorg](https://platform.jetbrains.com/u/jansorg)\
**Post date:** [July 21, 2025, 6:12pm UTC](https://platform.jetbrains.com/t/cant-inject-coroutinescope-into-light-service-constructors/2310/2 "2025-07-21T18:12:32Z")

</div>

Just a thought, but I remember that I had a similar problem when my plugin bundled its own coroutines library. The IDE looks for a constructor using the IDE‘s bundled coroutines library, but the plugin only definea a constructor with the classes from its own library. Unbundling / dropping the own coroutines dependency fixed this…

---

<div class="post-metadata">

**Author:** ![yuriy.artamonov](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/yuriy.artamonov/32/48_2.png) [@yuriy.artamonov](https://platform.jetbrains.com/u/yuriy.artamonov)\
**Post date:** [July 21, 2025, 7:57pm UTC](https://platform.jetbrains.com/t/cant-inject-coroutinescope-into-light-service-constructors/2310/3 "2025-07-21T19:57:47Z")

</div>

Please do not bundle your own Kotlin stdlib and coroutines, usually it is a problem

---

<div class="post-metadata">

**Author:** ![picimako](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/picimako/32/171_2.png) [@picimako](https://platform.jetbrains.com/u/picimako)\
**Post date:** [July 22, 2025, 3:21pm UTC](https://platform.jetbrains.com/t/cant-inject-coroutinescope-into-light-service-constructors/2310/4 "2025-07-22T15:21:14Z")

</div>

Thank you for the tip.

It wasn’t bundled explicitly, but it was coming transitively from other dependencies, so exluding coroutines solved the issue.
