juicedata/juicefs · error
Invalid endpoint: %v, error: %v
Error message
Invalid endpoint: %v, error: %v
What it means
newWasb in azure.go validates the configured endpoint with url.ParseRequestURI before splitting it into container/account host parts. This error is returned when the endpoint string (after prefixing https:// when no scheme was given) is not a valid absolute URL, so the Azure Blob backend cannot be constructed.
Source
Thrown at pkg/object/azure.go:311
}
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 {
return nil, fmt.Errorf("Invalid endpoint: %v, error: %v", endpoint, err)
}
hostParts := strings.SplitN(uri.Host, ".", 2)
containerName := hostParts[0]
// Priority 1: Connection string support
// DefaultEndpointsProtocol=[http|https];AccountName=***;AccountKey=***;EndpointSuffix=[core.windows.net|core.chinacloudapi.cn]
if connString := os.Getenv("AZURE_STORAGE_CONNECTION_STRING"); connString != "" {
logger.Debugf("Using Azure connection string authentication")
var client *azblob.Client
if client, err = azblob.NewClientFromConnectionString(connString, azblobOptions()); err != nil {
return nil, err
}
return &wasb{container: client.ServiceClient().NewContainerClient(containerName), azblobCli: client, cName: containerName, useTokenAuth: false}, nil
}
// Priority 2: No account key — use SAS token or managed identity
if accountKey == "" {
domain := domainFromHost(hostParts)View on GitHub (pinned to c9a67b23e8)
Solutions
- Set the endpoint to a clean absolute URL: https://<account>.blob.core.windows.net (no path, no spaces)
- Let the code add the scheme by passing just the host without :// — but keep it a bare hostname otherwise
- Check the environment/config value for stray quotes, spaces, or trailing slashes and correct them
- Print/log the endpoint string actually received by newWasb to spot invisible characters
Example fix
// before endpoint = "https://myaccount.blob.core.windows.net/mycontainer" // after endpoint = "https://myaccount.blob.core.windows.net"
Defensive patterns
Strategy: validation
Validate before calling
func validAzureEndpoint(ep string) bool {
if !strings.Contains(ep, "://") { ep = "https://" + ep }
u, err := url.ParseRequestURI(ep)
return err == nil && u.Host != "" && !strings.Contains(u.Path, "/")
} Prevention
- Store endpoints as bare hostnames or scheme+host only, never with a container path
- Trim spaces/quotes from endpoint env vars and config files
- Unit-test endpoint parsing with the exact values used in deployment
When it happens
Trigger: Passing an endpoint like "myaccount.blob.core.windows.net/" with a trailing path, "http//missing-colon", spaces, or other strings ParseRequestURI rejects to the Azure object storage constructor (also exercised by TestAzure).
Common situations: Typo'd AZURE_STORAGE_ENDPOINT values; copying an endpoint with a trailing slash+container; pasting a connection-string-like value into the endpoint field; missing scheme combined with characters that fail URI parsing.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/580b353dc2f9c298.
Report an issue: GitHub.