java.lang.ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain in 252.x runIde

error:

Task :runIde FAILED
[0.027s][warning][cds] Archived non-system classes are disabled because the java.system.class.loader property is specified (value = “com.intellij.util.lang.PathClassLoader”). To use archived non-system classes, this property must not be set
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Exception in thread “main” java.lang.ClassNotFoundException: kotlinx.coroutines.debug.AgentPremain
at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:236)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:504)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:572)
*** java.lang.instrument ASSERTION FAILED ***: “!errorOutstanding” with message Outstanding error when calling method in invokeJavaAgentMainMethod at s\src\java.instrument\share\native\libinstrument\JPLISAgent.c line: 627
*** java.lang.instrument ASSERTION FAILED ***: “success” with message invokeJavaAgentMainMethod failed at s\src\java.instrument\share\native\libinstrument\JPLISAgent.c line: 466
*** java.lang.instrument ASSERTION FAILED ***: “result” with message agent load/premain call failed at s\src\java.instrument\share\native\libinstrument\JPLISAgent.c line: 429

FAILURE: Build failed with an exception.

build.gradle:

plugins {
    id 'org.jetbrains.intellij.platform' version "2.2.0"
}

group = 'com.mok'
version = ''

repositories {
    mavenLocal()
    maven {
        allowInsecureProtocol = true
        url "http://maven.aliyun.com/nexus/content/groups/public/"
    }
    intellijPlatform {
        defaultRepositories()
    }
}

dependencies {
    testImplementation platform('org.junit:junit-bom:5.10.0')
    testImplementation 'org.junit.jupiter:junit-jupiter'

    implementation 'org.projectlombok:lombok:1.18.32'
    annotationProcessor 'org.projectlombok:lombok:1.18.32'
    implementation 'org.slf4j:slf4j-api:1.7.30'

    implementation 'cn.hutool:hutool-all:5.8.27'

    implementation 'com.alibaba.fastjson2:fastjson2:2.0.49'

    implementation 'ch.qos.logback:logback-classic:1.4.12'

    implementation("com.squareup.okhttp3:okhttp:4.12.0")

    implementation 'com.vladsch.flexmark:flexmark-all:0.64.8'

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'org.apache.commons:commons-text:1.12.0'

    implementation 'org.eclipse.lsp4j:org.eclipse.lsp4j:0.23.1'
    implementation("com.squareup.okhttp3:okhttp:4.12.0")

    implementation 'com.github.ben-manes.caffeine:caffeine:3.1.6'

    implementation 'io.netty:netty-all:4.1.96.Final'

    implementation 'org.eclipse.jgit:org.eclipse.jgit:6.9.0.202403050737-r'

    intellijPlatform {
        intellijIdeaCommunity '2025.2'
        bundledPlugin("Git4Idea")
        pluginVerifier()
        zipSigner()
        instrumentationTools()
    }
}


patchPluginXml {
    sinceBuild.set("223")
    untilBuild.set(provider { null })
}

tasks.withType(JavaCompile).configureEach {
    sourceCompatibility = "17"
    targetCompatibility = "17"
    options.encoding = "UTF-8"
}

test {
    useJUnitPlatform()
}

In Idea 252 version, the error messages for building and running are as above, and there are no issues with versions below 252

Could you please use the latest Gradle plugin 2.10.1 and IntelliJ version 2025.2.3 for compilation

I was able to reproduce the error, I’m investigating this problem now

before:
id ‘org.jetbrains.intellij.platform’ version “2.2.0”
bundledPlugin(“Git4Idea”)

after
id ‘org.jetbrains.intellij.platform’ version “2.6.0”
bundledPlugins(“org.jetbrains.plugins.terminal”, “Git4Idea”, “com.intellij.java”)

I changed these two contents and solved them

1 Like