Skip to content

Kotlin test failure on v2.1.20 #11844

@lgfa29

Description

@lgfa29

Description

The latest versions of kotlinc-js -version and kapt -version exit with non-zero status code, causing the tool tests to fail.

==> amazon-ebs.build_image: Provisioning with shell script: base-images/images/ubuntu/templates/../scripts/build/install-kotlin.sh
==> amazon-ebs.build_image: Downloading package from https://github.com/JetBrains/kotlin/releases/download/v2.1.20/kotlin-compiler-2.1.20.zip to /tmp/kotlin-compiler-2.1.20.zip...
==> amazon-ebs.build_image: Package downloaded in 1 seconds
==> amazon-ebs.build_image: Downloading package from https://github.com/JetBrains/kotlin/releases/download/v2.1.20/kotlin-compiler-2.1.20.zip.sha256 to /tmp/kotlin-compiler-2.1.20.zip.sha256...
==> amazon-ebs.build_image: Package downloaded in 0 seconds
    amazon-ebs.build_image: Performing checksum verification
    amazon-ebs.build_image: Checksum verification passed
    amazon-ebs.build_image: Pester v5.7.1
    amazon-ebs.build_image:
    amazon-ebs.build_image: Starting discovery in 1 files.
    amazon-ebs.build_image: Discovery found 85 tests in 570ms.
    amazon-ebs.build_image: Filter 'FullName' set to ('Kotlin').
    amazon-ebs.build_image: Filters selected 5 tests to run.
    amazon-ebs.build_image: Running tests.
    amazon-ebs.build_image:
    amazon-ebs.build_image: Running tests from '/imagegeneration/tests/Tools.Tests.ps1'
    amazon-ebs.build_image: Describing Kotlin
    amazon-ebs.build_image:   [-] kapt 1.93s (1.89s|40ms)
    amazon-ebs.build_image:    Command 'kapt -version' has finished with exit code
    amazon-ebs.build_image:        info: kotlinc-jvm 2.1.20 (JRE 17.0.14+7) error: [kapt] KAPT "compile" mode is not supported in Kotlin 2.x. Run kapt with -Kapt-mode=stubsAndApt and use kotlinc for the final compilation step.
    amazon-ebs.build_image:    at "kapt -version" | Should -ReturnZeroExitCode, /imagegeneration/tests/Tools.Tests.ps1:395
    amazon-ebs.build_image:    at <ScriptBlock>, /imagegeneration/tests/Tools.Tests.ps1:395
    amazon-ebs.build_image:   [+] kotlin 118ms (116ms|2ms)
    amazon-ebs.build_image:   [+] kotlinc 1.63s (1.63s|2ms)
    amazon-ebs.build_image:   [+] kotlinc-jvm 1.57s (1.57s|1ms)
    amazon-ebs.build_image:   [-] kotlinc-js 1.27s (1.27s|1ms)
    amazon-ebs.build_image:    Command 'kotlinc-js -version' has finished with exit code
    amazon-ebs.build_image:        info: kotlinc-js 2.1.20 (JRE 17.0.14+7) exception: java.lang.NullPointerException 	at org.jetbrains.kotlin.cli.pipeline.web.CommonWebConfigurationUpdater.initializeCommonConfiguration$cli_js(WebConfigurationPhase.kt:268) 	at org.jetbrains.kotlin.cli.pipeline.web.CommonWebConfigurationUpdater.fillConfiguration(WebConfigurationPhase.kt:55) 	at org.jetbrains.kotlin.cli.pipeline.AbstractConfigurationPhase.executePhase(AbstractConfigurationPhase.kt:49) 	at org.jetbrains.kotlin.cli.pipeline.AbstractConfigurationPhase.executePhase(AbstractConfigurationPhase.kt:38) 	at org.jetbrains.kotlin.cli.pipeline.PipelinePhase.phaseBody(PipelinePhase.kt:68) 	at org.jetbrains.kotlin.cli.pipeline.PipelinePhase.phaseBody(PipelinePhase.kt:58) 	at org.jetbrains.kotlin.config.phaser.SimpleNamedCompilerPhase.phaseBody(CompilerPhase.kt:215) 	at org.jetbrains.kotlin.config.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:111) 	at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:21) 	at org.jetbrains.kotlin.config.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:62) 	at org.jetbrains.kotlin.cli.pipeline.AbstractCliPipeline.runPhasedPipeline(AbstractCliPipeline.kt:106) 	at org.jetbrains.kotlin.cli.pipeline.AbstractCliPipeline.execute(AbstractCliPipeline.kt:65) 	at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecutePhased(K2JSCompiler.kt:63) 	at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecutePhased(K2JSCompiler.kt:49) 	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:80) 	at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:337) 	at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:315) 	at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:279) 	at org.jetbrains.kotlin.cli.common.CLICompiler$Companion.doMainNoExit(CLICompiler.kt:416) 	at org.jetbrains.kotlin.cli.common.CLICompiler$Companion.doMainNoExit$default(CLICompiler.kt:409) 	at org.jetbrains.kotlin.cli.common.CLICompiler$Companion.doMain(CLICompiler.kt:403) 	at org.jetbrains.kotlin.cli.js.K2JSCompiler$Companion.main(K2JSCompiler.kt:319) 	at org.jetbrains.kotlin.cli.js.K2JSCompiler.main(K2JSCompiler.kt) 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 	at java.base/java.lang.reflect.Method.invoke(Method.java:569) 	at org.jetbrains.kotlin.preloading.Preloader.run(Preloader.java:87) 	at org.jetbrains.kotlin.preloading.Preloader.main(Preloader.java:44)
    amazon-ebs.build_image:    at "kotlinc-js -version" | Should -ReturnZeroExitCode, /imagegeneration/tests/Tools.Tests.ps1:411
    amazon-ebs.build_image:    at <ScriptBlock>, /imagegeneration/tests/Tools.Tests.ps1:411
    amazon-ebs.build_image: Tests completed in 7.42s
    amazon-ebs.build_image: Tests Passed: 3, Failed: 2, Skipped: 0, Inconclusive: 0, NotRun: 80

This seems like it could be a bug in the tools themselves, so I opened a ticket to make the Kotlin team aware of this.

My workaround for now has been to pin the version of Kotlin in install-kotlin.sh, but if this behaviour doesn't get fixed upstream the test itself may need to be updated.

- download_url=$(resolve_github_release_asset_url "JetBrains/kotlin" "contains(\"kotlin-compiler\") and endswith(\".zip\")" "latest")
+ download_url=$(resolve_github_release_asset_url "JetBrains/kotlin" "contains(\"kotlin-compiler\") and endswith(\".zip\")" "2.1.10")

This fix also doesn't apply to the Windows images since they use a different pattern to determine the version to install, but I have only tested Ubuntu images.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

N/A

Is it regression?

N/A

Expected behavior

Kotlin tools installed successfully.

Actual behavior

kotlinc-js and kapt fail.

Repro steps

Build a new Ubuntu image.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions