Skip to content
Latchkey

Gradle "Toolchain auto-provisioning is not enabled" in CI

A resolver could provision the requested JDK, but org.gradle.java.installations.auto-download is set to false, so Gradle refuses to download it and fails instead of fetching the toolchain.

What this error means

The build fails with a toolchain message noting "Toolchain auto-provisioning is not enabled" or "auto-download is disabled" when no local JDK matches the request.

Gradle
> No compatible toolchains found for request specification: {languageVersion=21, ...} (auto-detect false, auto-download false).
  Toolchain auto-provisioning is not enabled.

Common causes

auto-download was disabled in properties

A gradle.properties (or command line) set org.gradle.java.installations.auto-download=false, so Gradle will not fetch a missing JDK.

auto-detect is off and no JDK path is configured

With auto-detect disabled and no explicit installation path, Gradle sees no local JDK and cannot download one.

How to fix it

Provide the JDK instead of downloading

Install the JDK on the runner so no auto-provisioning is needed, keeping downloads off in CI.

.github/workflows/ci.yml
- uses: actions/setup-java@v4
  with:
    distribution: temurin
    java-version: '21'

Enable auto-download deliberately

If you want Gradle to fetch the JDK, enable auto-download and apply a toolchain resolver.

gradle.properties
org.gradle.java.installations.auto-download=true

How to prevent it

  • Decide one strategy: install JDKs with setup-java, or enable auto-download plus a resolver.
  • Do not leave auto-download off while requesting an uninstalled toolchain.
  • Keep the toolchain request aligned with what the runner provides.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →