juicedata/juicefs · error

Invalid endpoint %s: %s

Error message

Invalid endpoint %s: %s

What it means

Returned by newWasabi when the Wasabi endpoint URL cannot be parsed after defaulting to https. A valid endpoint is like https://bucket.s3.region.wasabisys.com; the wrapped parse error pinpoints the defect.

Source

Thrown at pkg/object/wasabi.go:56

func (s *wasabi) String() string {
	return fmt.Sprintf("wasabi://%s/", s.s3client.bucket)
}

func (s *wasabi) InitTiers(_ Tiers) error {
	if err := s.tierStorage.InitTiers(nil); err != nil {
		return err
	}
	return notSupported
}

func newWasabi(endpoint, accessKey, secretKey, 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 %s: %s", endpoint, err)
	}
	ssl := strings.ToLower(uri.Scheme) == "https"
	hostParts := strings.Split(uri.Host, ".")
	bucket := hostParts[0]
	region := hostParts[2]
	endpoint = uri.Scheme + "://" + uri.Host[len(bucket)+1:]

	awsCfg, err := config.LoadDefaultConfig(ctx, append(defaultChecksumOpts(),
		config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, token)))...)
	if err != nil {
		return nil, fmt.Errorf("failed to load config: %s", err)
	}
	client := s3.NewFromConfig(awsCfg, func(options *s3.Options) {
		options.Region = region
		options.BaseEndpoint = aws.String(endpoint)
		options.EndpointOptions.DisableHTTPS = !ssl
		options.UsePathStyle = false
		options.HTTPClient = httpClient

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Inspect the endpoint string for whitespace or invalid characters
  2. Use a valid host form, e.g. s3.us-west-1.wasabisys.com or with https:// scheme
  3. Ensure the variable holding the endpoint is actually expanded
  4. Percent-encode special characters if they must be present

Example fix

// before
--storage-endpoint "$WASABI_ENDPOINT"  # empty -> https://
// after
--storage-endpoint "s3.us-west-1.wasabisys.com"
Defensive patterns

Strategy: validation

Validate before calling

func validWasabiEndpoint(ep string) error {
	if !strings.Contains(ep, "://") { ep = "https://" + ep }
	_, err := url.ParseRequestURI(ep)
	return err
}

Try / catch

_, err := object.CreateStorage(ctx, "wasabi", url, ak, sk)
if err != nil && strings.HasPrefix(err.Error(), "Invalid endpoint") {
	// correct endpoint and retry
}

Prevention

When it happens

Trigger: Wasabi storage URL with an unparseable endpoint: empty value, illegal characters, stray whitespace, or a scheme-only/garbage string.

Common situations: Typo in the endpoint in juicefs format/mount; unexpanded shell or template variable; quotes/spaces pasted into the config; forgetting the host entirely.

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/9606a2dd8ebb4c4f. Report an issue: GitHub.