Skip to content

[BUG] Claude Code on the Web: Gradle wrapper fails to download distribution - Java doesn't honor https_proxyΒ #16222

@smh

Description

@smh

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The Gradle wrapper fails to download the Gradle distribution in Claude Code on the Web, even with "Full" (All domains) network access enabled. The error is java.net.UnknownHostException: services.gradle.org.

Root cause: The sandbox environment routes traffic through a proxy using the https_proxy environment variable. While curl and other tools honor this variable, Java's HttpURLConnection (used by the Gradle wrapper) does not automatically use https_proxy. Java requires explicit JVM arguments (-Dhttp.proxyHost, -Dhttps.proxyHost, etc.) to configure proxy settings.

This means any Java-based tool that downloads files (Gradle wrapper, Maven wrapper, etc.) will fail with DNS resolution errors, while the same URLs work fine with curl.

Environment:

  • Platform: Claude Code on the Web (cloud sandbox)
  • Network Setting: "Full" / "All domains" enabled
  • Gradle version: 9.2.1 (configured in gradle-wrapper.properties)
  • Pre-installed JDK: OpenJDK 21.0.9 (Ubuntu 21.0.9+10-Ubuntu-124.04)

What Should Happen?

Java processes should be able to access allowed network domains through the proxy. This could be achieved by configuring JVM proxy settings globally in the sandbox environment via JAVA_TOOL_OPTIONS:

export JAVA_TOOL_OPTIONS="-Dhttp.proxyHost=<proxy> -Dhttp.proxyPort=<port> -Dhttps.proxyHost=<proxy> -Dhttps.proxyPort=<port>"

Alternatively, document this limitation and provide a workaround.

Error Messages/Logs

Exception in thread "main" java.net.UnknownHostException: services.gradle.org
    at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:567)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
    at java.base/java.net.Socket.connect(Socket.java:751)
    at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304)
    at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:531)
    at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:636)
    at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
    at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:377)
    at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1257)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1143)
    at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1705)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1629)
    at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
    at org.gradle.wrapper.Install.forceFetch(SourceFile:2)
    at org.gradle.wrapper.Install$1.call(SourceFile:8)
    at org.gradle.wrapper.GradleWrapperMain.main(SourceFile:67)

Downloading https://services.gradle.org/distributions/gradle-9.2.1-bin.zip

Steps to Reproduce

  1. Create or use a Java/Kotlin project with Gradle wrapper configured for Gradle 9.x
  2. Start a Claude Code on the Web session with "Full" network access
  3. Run ./gradlew --version
  4. Observe the UnknownHostException for services.gradle.org

Proof that the domain is accessible via curl:

# This works - curl honors https_proxy
curl -v -L --connect-timeout 10 "https://services.gradle.org/distributions/gradle-9.2.1-bin.zip" -o /tmp/gradle.zip
# Successfully downloads 135MB zip file

# This fails - Java doesn't honor https_proxy  
./gradlew --version
# UnknownHostException: services.gradle.org

Workaround: Manually download with curl and place in Gradle wrapper cache, then ./gradlew --version works.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

web

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    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