Skip to content

5.1.0 fails to read .tool-versions #967

Description

@othmane-kinane-nw

Action versions

  • Working: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 (5.0.0)
  • Failing: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e (5.1.0)

Config

File: api/.tool-versions

java temurin-v21.0.7

Workflow usage (simplified)

- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e
  with:
    distribution: temurin
    java-version-file: api/.tool-versions

Steps to reproduce

  1. Create api/.tool-versions with the content above.
  2. Use java-version-file: api/.tool-versions with the 5.1.0 action.
  3. Run the workflow.

Actual behavior (5.1.0 – f2beeb2)

The step fails with:

Installed distributions
  Error: No supported version was found in file api/.tool-versions
  (node:2014) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.

Expected behavior (5.0.0 – dded088)

The same file works and Java 21.0.7 is resolved, downloaded, and configured successfully.

Full logs

5.1.0 (failing)

Prepare all required actions
Getting action download info
Download action repository 'actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e' (SHA:f2beeb24e141e01a676f977032f5a29d81c9e27e)
Run ./.github/actions/setup-java
Run actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e
Installed distributions
  Error: No supported version was found in file api/.tool-versions
  (node:2014) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  (Use `node --trace-deprecation ...` to show where the warning was created)

5.0.0 (working)

Prepare all required actions
Getting action download info
Download action repository 'actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165' (SHA:dded0888837ed1f317902acf8a20df0ad188d165)
Run ./.github/actions/setup-java
Run actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165
Installed distributions
  Trying to resolve the latest version from remote
  (node:2038) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  (Use `node --trace-deprecation ...` to show where the warning was created)
  Resolved latest version as 21.0.7+6.0.LTS
  Trying to download...
  Downloading Java 21.0.7+6.0.LTS (Temurin-Hotspot) from https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.7%2B6/OpenJDK21U-jdk_x64_linux_hotspot_21.0.7_6.tar.gz ...
  Extracting Java archive...
  /usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/8140c74e-3794-4b1b-aa91-b34b33c475c5 -f /home/runner/work/_temp/cbf5fc09-8cbf-40af-90cc-474455cad3dc
  Java 21.0.7+6.0.LTS was downloaded
  Setting Java 21.0.7+6.0.LTS as the default
  Creating toolchains.xml for JDK version 21.0.7 from temurin
  Writing to /home/runner/.m2/toolchains.xml

  Java configuration:
    Distribution: temurin
    Version: 21.0.7+6.0.LTS
    Path: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.7-6.0.LTS/x64

Creating settings.xml with server-id: github
Writing to /home/runner/.m2/settings.xml
maven cache is not found

Activity

  1. v-priyagupta108 commented on Dec 4, 2025

    @v-priyagupta108
    Contributor

    Hello @othmane-kinane-nw 👋,
    Thank you for your report. We'll investigate the issue and get back to you with the details!

  2. v-aparnajyothi-y commented on Dec 5, 2025

    @v-aparnajyothi-y
    Contributor

    Hello @othmane-kinane-nw, Thanks for raising this and for sharing the detailed comparison between 5.0.0 and 5.1.0, really appreciate the clarity here.

    We’ve taken a closer look, and the behavior change you’re seeing is tied to how version strings are parsed from .tool-versions in 5.1.0. As part of the improvements made in PR #767, the parsing logic was tightened to align with the documented asdf format and to avoid extracting invalid version identifiers. In 5.0.0, the parser was more permissive and accepted strings such as:

    java temurin-v21.0.7

    However, this format is not currently supported. The documented and intended pattern (as described in the PR) is:

    java temurin-21.0.7
    (without the leading v in the version segment)

    In 5.1.0, the updated regex correctly excludes v21.0.7 because it treats the v prefix as part of the distribution token rather than the numeric version as per asdf format. As a result, the extracted value is no longer a valid Java version, and the action reports:
    Error: No supported version was found in file api/.tool-versions. So from the action’s perspective, this is expected behavior in 5.1.0, the parser is now enforcing the documented .tool-versions structure.

    Tried to remove the leading v and update the entry to:
    java temurin-21.0.7

    the action should work as expected under 5.1.0. Please find the screenshot for reference.
    Please feel free to reach us in case of further concerns or clarifiactions required :)

    Image Image
  3. othmane-kinane-nw commented on Dec 5, 2025

    @othmane-kinane-nw
    Author

    I removed the v and it worked !

    Thank you @aparnajyothi-y 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions