{"record":{"id":"387a8ff6ff1c75ec","repo":"juicedata/juicefs","slug":"fail-to-auto-detect-endpoint-w","errorCode":null,"errorMessage":"fail to auto-detect endpoint: %w","messagePattern":"fail to auto-detect endpoint: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/azure.go","lineNumber":292,"sourceCode":"\t\t\tlogger.Debugf(\"Attempt to resolve domain name %s failed: %s\", baseURL, err)\n\t\t\tlastErr = err\n\t\t\tcontinue\n\t\t}\n\t\tserviceURL := fmt.Sprintf(\"%s://%s.%s\", scheme, accountName, baseURL)\n\t\tclient, err := makeClient(serviceURL)\n\t\tif err != nil {\n\t\t\tlogger.Debugf(\"Try to create client at %s failed: %s\", baseURL, err)\n\t\t\tlastErr = err\n\t\t\tcontinue\n\t\t}\n\t\tif _, err = client.ServiceClient().GetProperties(ctx, nil); err != nil {\n\t\t\tlogger.Debugf(\"Try to get service properties at %s failed: %s\", baseURL, err)\n\t\t\tlastErr = err\n\t\t\tcontinue\n\t\t}\n\t\treturn baseURL, nil\n\t}\n\treturn \"\", fmt.Errorf(\"fail to auto-detect endpoint: %w\", lastErr)\n}\n\nfunc azblobOptions() *azblob.ClientOptions {\n\treturn &azblob.ClientOptions{\n\t\tClientOptions: azcore.ClientOptions{\n\t\t\tTelemetry: policy.TelemetryOptions{\n\t\t\t\tApplicationID: UserAgent,\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc newWasb(endpoint, accountName, accountKey, token string) (ObjectStorage, error) {\n\tif !strings.Contains(endpoint, \"://\") {\n\t\tendpoint = fmt.Sprintf(\"https://%s\", endpoint)\n\t}\n\turi, err := url.ParseRequestURI(endpoint)\n\tif err != nil {","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/azure.go#L274-L310","documentation":"autoWasbEndpoint in azure.go probes candidate base URLs (via GetServiceProperties) to auto-detect the correct WASB endpoint for the account. If every candidate probe fails, it wraps the last probe error with this message. It means the Azure Storage account could not be reached and no endpoint could be inferred.","triggerScenarios":"newWasb called without an explicit endpoint (needing auto-detection) while all probe requests fail: DNS failure, network egress blocked, wrong account name, 403 from bad credentials, or the storage account existing only in a sovereign cloud not probed.","commonSituations":"Configuring an Azure backend with just an account name from an on-prem/network-restricted environment; using an account in Azure China/Government whose default endpoint differs; typo in account name so DNS (account.blob.core.windows.net) fails.","solutions":["Provide an explicit endpoint (e.g. https://<account>.blob.core.windows.net or the appropriate sovereign-cloud URL) instead of relying on auto-detection","Fix network/DNS egress so the client can reach <account>.blob.core.windows.net:443","Verify the storage account name and that the account exists (`az storage account show`)","Check credentials: a 403 on the probe means account key/token are wrong — correct them"],"exampleFix":"// before\nAZURE_STORAGE_ENDPOINT= (unset, forces auto-detect)\n// after\nAZURE_STORAGE_ENDPOINT=https://myaccount.blob.core.chinacloudapi.cn","handlingStrategy":"fallback","validationCode":"if os.Getenv(\"AZURE_STORAGE_ENDPOINT\") == \"\" { logger.Warn(\"endpoint unset; auto-detection requires network access to <account>.blob.core.windows.net\") }","typeGuard":null,"tryCatchPattern":"if ep, err := autoWasbEndpoint(...); err != nil {\n  var respErr azhttp.ResponseError\n  if errors.As(err, &respErr) && respErr.StatusCode == 403 { /* bad creds */ }\n  return fmt.Errorf(\"set AZURE_STORAGE_ENDPOINT explicitly: %w\", err)\n}","preventionTips":["Set AZURE_STORAGE_ENDPOINT explicitly in restricted or sovereign-cloud environments","Verify account name and DNS resolution before mounting","Open egress to *.blob.core.windows.net:443","Validate credentials before probing (403 means keys/token are wrong)"],"tags":["azure","network","endpoint","storage"],"backgroundTag":"http-request-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}