{"record":{"id":"7cba1678755ef29c","repo":"juicedata/juicefs","slug":"get-proxy-url-for-endpoint-s-error-q","errorCode":null,"errorMessage":"get proxy url for endpoint: %s error: %q","messagePattern":"get proxy url for endpoint: (.+?) error: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/obs.go","lineNumber":421,"sourceCode":"\tvar region string\n\tif len(hostParts) == 1 {\n\t\tif endpoint, err = autoOBSEndpoint(bucketName, accessKey, secretKey, token); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot get location of bucket %s: %q\", bucketName, err)\n\t\t}\n\t\tif !strings.HasPrefix(endpoint, \"http\") {\n\t\t\tendpoint = fmt.Sprintf(\"%s://%s\", uri.Scheme, endpoint)\n\t\t}\n\t} else {\n\t\tregion = strings.Split(hostParts[1], \".\")[1]\n\t}\n\n\t// Use proxy setting from environment variables: HTTP_PROXY, HTTPS_PROXY, NO_PROXY\n\tif uri, err = url.ParseRequestURI(endpoint); err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid endpoint %s: %q\", endpoint, err)\n\t}\n\tproxyURL, err := httpproxy.FromEnvironment().ProxyFunc()(uri)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get proxy url for endpoint: %s error: %q\", endpoint, err)\n\t}\n\tvar urlString string\n\tif proxyURL != nil {\n\t\turlString = proxyURL.String()\n\t}\n\n\t// Empty proxy url string has no effect\n\t// there is a bug in the retry of PUT (did not call Seek(0,0) before retry), so disable the retry here\n\tc, err := obs.New(accessKey, secretKey, endpoint, obs.WithSecurityToken(token),\n\t\tobs.WithProxyUrl(urlString), obs.WithMaxRetryCount(0), obs.WithUserAgent(UserAgent),\n\t\tobs.WithHttpTransport(httpClient.Transport.(*http.Transport)))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to initialize OBS: %q\", err)\n\t}\n\tvar checkEtag bool\n\tif _, err = c.GetBucketEncryption(bucketName); err != nil {\n\t\tif obsError, ok := err.(obs.ObsError); ok && obsError.Code == \"NoSuchEncryptionConfiguration\" {\n\t\t\tcheckEtag = true","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/obs.go#L403-L439","documentation":"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>'.","triggerScenarios":"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.","commonSituations":"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).","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)"],"exampleFix":"// before\nexport HTTPS_PROXY=proxy.corp.example:3128\n// after\nexport HTTPS_PROXY=http://proxy.corp.example:3128","handlingStrategy":"validation","validationCode":"for _, v := range []string{\"HTTP_PROXY\",\"HTTPS_PROXY\",\"NO_PROXY\"} {\n\tif p := os.Getenv(v); p != \"\" {\n\t\tif _, err := url.Parse(p); err != nil { return fmt.Errorf(\"bad %s: %w\", v, err) }\n\t}\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"get proxy url\") {\n\t// unset or fix proxy env vars and retry\n}","preventionTips":["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"],"tags":["proxy","env","obs","network"],"backgroundTag":"invalid-env-var-value","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}