Inspectopedia 2025.3 Help

'runBlocking' inside suspend function

Reports runBlocking calls inside suspend functions.

Using runBlocking within a suspend function blocks the calling thread and defeats the purpose of asynchronous programming.

The quick-fix replaces the runBlocking call with one of the following alternatives, depending on the context:

  • A run call.

  • A withContext call when a specific CoroutineContext is used.

  • Directly inlined code without the runBlocking wrapper.

Example:

suspend fun something() { runBlocking { code() // The thread is blocked here } }

After the quick-fix is applied:

suspend fun something() { code() // Runs asynchronously }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

RunBlockingInSuspendFunction
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Kotlin | Coroutine inspections

Inspection ID: RunBlockingInSuspendFunction

New in 2025.1

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection RunBlockingInSuspendFunction

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.3, Qodana for JVM 2025.3,

Last modified: 03 December 2025