Skip to content

Report HTTP proxy errors #23284

Open
Open

Description

@KrilleGH

Summary

When a HTTP proxy environment variable, e. g. HTTP_PROXY is set, then uv will use that proxy. However that happens silently, even in the verbose output.

Due to the pecularities of uv's Rust network stack it won't be able to resolve single label names. So if HTTP_PROXY=http://proxy is set this leads to the following error:

$ uv lock --upgrade-package lxml
  cause: Failed to fetch:
         https://devpi.local/lst/stable/+simple/requests-oauthlib/
  cause: error sending request for url
         (https://devpi.local/lst/stable/+simple/requests-oauthlib/)
  cause: client error (Connect)
  cause: tunnel error: failed to create underlying connection
  cause: dns error
  cause: error resolving DNS
  cause: failed to lookup address information: Name does not resolve

The resources given in the error message work entirely fine. So the DNS error looks pretty weird. After serious headscratching it turns out that it's actually true that there was a DNS error and the issue is that the name of the proxy can't be resolved since it has only one label. When setting HTTP_PROXY=http://proxy.local it will work fine.

This only happens with musl builds of uv, as installed through the distroless docker image. On Glibc based systems it doesn't happen when uv is installed through pip, as this results in a version without the problematic code. It uses Glibc instead, which is able to resolve single label names.

Please make a clearer error message in this case. If the problem is actually the connection to the proxy then explicitly state that and mention the proxy's URL instead, or in addition to, the URL that was attempted to load through it.

Platform

Debian GNU/Linux 13 (trixie), Linux 5.14.0-741.22.1.el9_9.x86_64 x86_64 GNU/Linux

Version

uv 0.13.9 (x86_64-unknown-linux-musl)

Python version

Python 3.14.9

Activity

  1. added
    bug
    on Nov 18, 2026
  2. arifrhm commented on Nov 19, 2026

    @arifrhm

    Hi @KrilleGH! I've submitted a fix for this in PR #23292.

    The PR addresses both aspects mentioned in the issue:

    1. Detects proxy tunnel and connection errors (hyper_util tunnel & SOCKS errors) and clearly reports Failed to connect to proxy <proxy_url>: <underlying error> instead of misleadingly blaming the target URL's DNS resolution.
    2. Automatically redacts proxy credentials/passwords to ensure no secret leakage.
    3. Logs active proxy configuration (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY) in debug! verbose output.
    4. Adds an actionable hint prompting to verify proxy settings and reachability instead of showing the misleading offline error.
  3. KrilleGH commented on Nov 19, 2026

    @KrilleGH
    Author

    Hi @arifrhm,
    while I don't have much clue about Rust or uv internals, your PR looks good to me. Thank you! 🚀

  4. konsti-openai commented on Nov 19, 2026

    @konsti-openai
    Contributor

    I put up a reqwest fix: seanmonstar/reqwest#3144

  5. KrilleGH commented on Nov 19, 2026

    @KrilleGH
    Author

    Besides the upstream fix I'd also like to see some verbose messages about the proxy being in effect from uv itself before anything happens.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions