juicedata/juicefs · error
fail to auto-detect endpoint: %w
Error message
fail to auto-detect endpoint: %w
What it means
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.
Source
Thrown at pkg/object/azure.go:292
logger.Debugf("Attempt to resolve domain name %s failed: %s", baseURL, err)
lastErr = err
continue
}
serviceURL := fmt.Sprintf("%s://%s.%s", scheme, accountName, baseURL)
client, err := makeClient(serviceURL)
if err != nil {
logger.Debugf("Try to create client at %s failed: %s", baseURL, err)
lastErr = err
continue
}
if _, err = client.ServiceClient().GetProperties(ctx, nil); err != nil {
logger.Debugf("Try to get service properties at %s failed: %s", baseURL, err)
lastErr = err
continue
}
return baseURL, nil
}
return "", fmt.Errorf("fail to auto-detect endpoint: %w", lastErr)
}
func azblobOptions() *azblob.ClientOptions {
return &azblob.ClientOptions{
ClientOptions: azcore.ClientOptions{
Telemetry: policy.TelemetryOptions{
ApplicationID: UserAgent,
},
},
}
}
func newWasb(endpoint, accountName, accountKey, token string) (ObjectStorage, error) {
if !strings.Contains(endpoint, "://") {
endpoint = fmt.Sprintf("https://%s", endpoint)
}
uri, err := url.ParseRequestURI(endpoint)
if err != nil {View on GitHub (pinned to c9a67b23e8)
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
Example fix
// before AZURE_STORAGE_ENDPOINT= (unset, forces auto-detect) // after AZURE_STORAGE_ENDPOINT=https://myaccount.blob.core.chinacloudapi.cn
Defensive patterns
Strategy: fallback
Validate before calling
if os.Getenv("AZURE_STORAGE_ENDPOINT") == "" { logger.Warn("endpoint unset; auto-detection requires network access to <account>.blob.core.windows.net") } Try / catch
if ep, err := autoWasbEndpoint(...); err != nil {
var respErr azhttp.ResponseError
if errors.As(err, &respErr) && respErr.StatusCode == 403 { /* bad creds */ }
return fmt.Errorf("set AZURE_STORAGE_ENDPOINT explicitly: %w", err)
} Prevention
- 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)
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Invalid endpoint: %v, error: %v
- Unable to get endpoint of container %s: %s
- Unable to get endpoint of container %s: %w
- are you connected to the network?
- error GET request: %v
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/387a8ff6ff1c75ec.
Report an issue: GitHub.