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

Status Open
Maintainer reply None cached
Activity 5 comments · opened Jan 4, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] 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_

View original on GitHub ↗

5 Comments

github-actions[bot] · 7 months ago

---

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13372
  2. https://github.com/anthropics/claude-code/issues/12752
  3. https://github.com/anthropics/claude-code/issues/11220

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

brendanlong · 7 months ago

I tried setting various JAVA_TOOL_OPTIONS to try to work around this, but I always got auth errors no matter what I tried (Claude seems to think Gradle isn't setting up basic auth correctly).

I tried vendoring everything but git lfs doesn't seem to work either:

git lfs pull 2>&1
Use `git lfs logs last` to view the log.
batch response: Fatal error: Server error &{%!!(string=http) %!!(string=) %!!(*url.Userinfo=&{local_proxy  false}) %!!(string=127.0.0.1:18439) %!!(string=/git/brendanlong/lion-reader.git/info/lfs/objects/batch) %!!(string=) %!!(bool=false) %!!(bool=false) %!!(string=) %!!(string=) %!!(string=)}s(MISSING) from HTTP 502

Errors logged to '/home/user/lion-reader/.git/lfs/logs/20260111T215435.016064847.log'.
Use `git lfs logs last` to view the log.
batch response: Fatal error: Server error &{%!!(string=http) %!!(string=) %!!(*url.Userinfo=&{local_proxy  false}) %!!(string=127.0.0.1:18439) %!!(string=/git/brendanlong/lion-reader.git/info/lfs/objects/batch) %!!(string=) %!!(bool=false) %!!(bool=false) %!!(string=) %!!(string=) %!!(string=)}s(MISSING) from HTTP 502

Errors logged to '/home/user/lion-reader/.git/lfs/logs/20260111T215435.017303518.log'.
Use `git lfs logs last` to view the log.
Failed to fetch some objects from 'http://local_proxy@127.0.0.1:18439/git/brendanlong/lion-reader.git/info/lfs'... +12 lines
tschuehly · 6 months ago

This is really annoying

outofcoffee · 6 months ago

As a work-around, try setting the http.proxyHost and related settings in the /root/.gradle/gradle.properties file in the sandbox.

🤖 Claude suggested this work-around, and it worked for me:

PROXY_HOST=$(echo "$https_proxy" | sed 's|.*@||' | sed 's|:.*||') && PROXY_PORT=$(echo "$https_proxy" | sed 's|.*:||') && PROXY_USER=$(echo "$https_proxy" | sed 's|http://||' | sed 's|@.*||' | sed 's|:.*||') && PROXY_PASS=$(echo "$https_proxy" | sed 's|http://||' | sed 's|@.*||' | sed 's|^[^:]*:||') && cat > /root/.gradle/gradle.properties << PROPEOF 
systemProp.http.proxyHost=$PROXY_HOST
systemProp.http.proxyPort=$PROXY_PORT
systemProp.http.proxyUser=$PROXY_USER
systemProp.http.proxyPassword=$PROXY_PASS
systemProp.https.proxyHost=$PROXY_HOST
systemProp.https.proxyPort=$PROXY_PORT
systemProp.https.proxyUser=$PROXY_USER
systemProp.https.proxyPassword=$PROXY_PASS
systemProp.jdk.http.auth.tunneling.disabledSchemes=
systemProp.jdk.http.auth.proxying.disabledSchemes=
PROPEOF

After this, the ./gradlew <cmd> Gradle wrapper commands were able to download the configured distribution and work as expected.

demonday · 29 days ago

We're hitting the same problem class on the local sandbox (sandbox.enabled via enterprise
managed settings) — not just Claude Code on the Web. Claude Code 2.1.220, Ubuntu 26.04 aarch64
(bubblewrap), Bedrock auth, managed-domains-only allowlist (internal Cloudsmith Maven mirror).

Local-sandbox repro (Maven Wrapper, empty ~/.m2)

The sandbox injects HTTPS_PROXY=http://srt:<per-session-token>@localhost:3128. Running
./mvnw inside a sandboxed Bash command:

  1. Wrapper jar download (shell/wget): works — wget reads the credentials out of

$HTTPS_PROXY itself.

  1. Maven distribution download (Java DefaultDownloader): cannot be made to work.
  • No proxy sysprops → java.net.UnknownHostException (expected — no direct egress in the netns).
  • With `-Dhttps.proxyHost=localhost -Dhttps.proxyPort=3128 -Dhttps.proxyUser=… -Dhttps.proxyPassword=…

-Djdk.http.auth.tunneling.disabledSchemes=`:

``
java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"
at java.base/sun.net.www.protocol.http.HttpURLConnection.doTunneling0(...)
at org.apache.maven.wrapper.DefaultDownloader.download(DefaultDownloader.java:85)
``

This is unfixable from user config: https.proxyUser/proxyPassword are not JDK properties
(absent from the Networking Properties doc);
the JDK only sends Proxy-Authorization via a programmatically registered
java.net.Authenticator, and only after a 407 challenge
(JDK-8210814). Oracle closed the exact
Gradle/Maven-wrapper 407 scenario as expected behavior
(JDK-8171351). The Maven Wrapper itself has no
proxy-auth support (MWRAPPER-46, open
since 2021). So for raw-JDK downloaders the per-session-credential proxy is a hard wall, and
tools that do implement proxy auth (Maven core via settings.xml, Gradle via systemProp.*)
need their config regenerated every session because the credentials rotate.