[BUG] Claude Code on the Web: Gradle wrapper fails to download distribution - Java doesn't honor https_proxy
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
- Create or use a Java/Kotlin project with Gradle wrapper configured for Gradle 9.x
- Start a Claude Code on the Web session with "Full" network access
- Run
./gradlew --version - Observe the
UnknownHostExceptionforservices.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_
5 Comments
---
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I tried setting various
JAVA_TOOL_OPTIONSto 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 lfsdoesn't seem to work either:This is really annoying
As a work-around, try setting the
http.proxyHostand related settings in the/root/.gradle/gradle.propertiesfile in the sandbox.🤖 Claude suggested this work-around, and it worked for me:
After this, the
./gradlew <cmd>Gradle wrapper commands were able to download the configured distribution and work as expected.We're hitting the same problem class on the local sandbox (
sandbox.enabledvia enterprisemanaged 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./mvnwinside a sandboxed Bash command:$HTTPS_PROXYitself.DefaultDownloader): cannot be made to work.java.net.UnknownHostException(expected — no direct egress in the netns).-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/proxyPasswordare not JDK properties(absent from the Networking Properties doc);
the JDK only sends
Proxy-Authorizationvia a programmatically registeredjava.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 viasystemProp.*)need their config regenerated every session because the credentials rotate.