juicedata/juicefs · error
get proxy url for endpoint: %s error: %q
Error message
get proxy url for endpoint: %s error: %q
What it means
newOBS honors HTTP_PROXY/HTTPS_PROXY/NO_PROXY by resolving a proxy for the endpoint via httpproxy.FromEnvironment(). If the proxy function errors (e.g. proxy URL in env is unparseable or the scheme/host is unsupported for proxying), construction aborts with 'get proxy url for endpoint: <endpoint> error: <cause>'.
Source
Thrown at pkg/object/obs.go:421
var region string
if len(hostParts) == 1 {
if endpoint, err = autoOBSEndpoint(bucketName, accessKey, secretKey, token); err != nil {
return nil, fmt.Errorf("cannot get location of bucket %s: %q", bucketName, err)
}
if !strings.HasPrefix(endpoint, "http") {
endpoint = fmt.Sprintf("%s://%s", uri.Scheme, endpoint)
}
} else {
region = strings.Split(hostParts[1], ".")[1]
}
// Use proxy setting from environment variables: HTTP_PROXY, HTTPS_PROXY, NO_PROXY
if uri, err = url.ParseRequestURI(endpoint); err != nil {
return nil, fmt.Errorf("invalid endpoint %s: %q", endpoint, err)
}
proxyURL, err := httpproxy.FromEnvironment().ProxyFunc()(uri)
if err != nil {
return nil, fmt.Errorf("get proxy url for endpoint: %s error: %q", endpoint, err)
}
var urlString string
if proxyURL != nil {
urlString = proxyURL.String()
}
// Empty proxy url string has no effect
// there is a bug in the retry of PUT (did not call Seek(0,0) before retry), so disable the retry here
c, err := obs.New(accessKey, secretKey, endpoint, obs.WithSecurityToken(token),
obs.WithProxyUrl(urlString), obs.WithMaxRetryCount(0), obs.WithUserAgent(UserAgent),
obs.WithHttpTransport(httpClient.Transport.(*http.Transport)))
if err != nil {
return nil, fmt.Errorf("fail to initialize OBS: %q", err)
}
var checkEtag bool
if _, err = c.GetBucketEncryption(bucketName); err != nil {
if obsError, ok := err.(obs.ObsError); ok && obsError.Code == "NoSuchEncryptionConfiguration" {
checkEtag = trueView on GitHub (pinned to c9a67b23e8)
Solutions
- Check HTTP_PROXY/HTTPS_PROXY/NO_PROXY values for validity (full http:// scheme, valid URL)
- Unset the proxy vars and retry to confirm the proxy config is the cause
- Correct the proxy URL format (e.g. http://proxy.corp.example:3128)
- Fix invalid NO_PROXY entries (domains/CIDRs)
Example fix
// before export HTTPS_PROXY=proxy.corp.example:3128 // after export HTTPS_PROXY=http://proxy.corp.example:3128
Defensive patterns
Strategy: validation
Validate before calling
for _, v := range []string{"HTTP_PROXY","HTTPS_PROXY","NO_PROXY"} {
if p := os.Getenv(v); p != "" {
if _, err := url.Parse(p); err != nil { return fmt.Errorf("bad %s: %w", v, err) }
}
} Try / catch
if err != nil && strings.Contains(err.Error(), "get proxy url") {
// unset or fix proxy env vars and retry
} Prevention
- Always use full scheme in proxy env URLs (http://...)
- Test proxy settings with a simple HTTP client before storage setup
- Document proxy requirements for operators
When it happens
Trigger: HTTP_PROXY/HTTPS_PROXY/NO_PROXY environment variables set to malformed URLs (e.g. missing scheme like 'proxy.corp:3128' handled poorly, or invalid percent-escapes) while creating OBS storage.
Common situations: Corporate proxy misconfigured in env; typos in NO_PROXY CIDR notation; proxy URL with unsupported scheme (socks variants not accepted by httpproxy ProxyFunc for http transport).
Understand the failure class
Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.
Related errors
- are you connected to the network?
- error GET request: %v
- Failed to create bucket %s: %s, previous error: %s
- failed to convert %s to %s: %w
- (cancelled) upload block %s: %s (after %d tries)
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/7cba1678755ef29c.
Report an issue: GitHub.