juicedata/juicefs · error

invalid endpoint %s: %s

Error message

invalid endpoint %s: %s

What it means

Returned by newEos when the EOS (EMC Elastic Object Storage) endpoint cannot be parsed as a URL after defaulting to https. A valid endpoint like https://bucket.eosendpoint is required; the wrapped parse error identifies the malformed part.

Source

Thrown at pkg/object/eos.go:60

}

func (s *eos) Limits() Limits {
	return Limits{
		IsSupportMultipartUpload: true,
		IsSupportUploadPartCopy:  true,
		MinPartSize:              4 << 20,
		MaxPartSize:              5 << 30,
		MaxPartCount:             10000,
	}
}

func newEos(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]
	endpoint = uri.Scheme + "://" + uri.Host[len(bucket)+1:]
	region := "us-east-1"

	if accessKey == "" {
		accessKey = os.Getenv("EOS_ACCESS_KEY")
	}
	if secretKey == "" {
		secretKey = os.Getenv("EOS_SECRET_KEY")
	}
	if token == "" {
		token = os.Getenv("EOS_TOKEN")
	}
	cfg, err := config.LoadDefaultConfig(ctx, append(defaultChecksumOpts(),
		config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider(accessKey, secretKey, token)))...)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Set the endpoint to a valid URL like 'eos-name.ctyun.cn' or 'https://eos-name.ctyun.cn' (scheme is optional but content must be a parseable URI)
  2. Trim whitespace/quotes from the config value or env var
  3. Check for unexpanded template variables in the config file
  4. URL-escape any special characters in the endpoint

Example fix

// before
store, err := createStorage("eos", "", accessKey, secretKey) // invalid endpoint :
// after
store, err := createStorage("eos", "eos.eu-west-1.outscale.com", accessKey, secretKey)
Defensive patterns

Strategy: validation

Validate before calling

u, err := url.ParseRequestURI(strings.TrimSpace(endpoint))
if err != nil || u.Host == "" {
	return fmt.Errorf("endpoint %q is not a valid URL", endpoint)
}

Type guard

func validEndpoint(s string) bool { _, err := url.ParseRequestURI(strings.TrimSpace(s)); return err == nil }

Try / catch

store, err := createStorage("eos", endpoint, ak, sk)
if err != nil && strings.HasPrefix(err.Error(), "invalid endpoint") {
	// fix endpoint in config/env, then retry
}

Prevention

When it happens

Trigger: Calling newEos (via createStorage with the 'eos' storage type, or TestEOS) with an endpoint string that url.ParseRequestURI cannot parse — e.g. empty string, spaces, stray colon-only authority, or malformed characters.

Common situations: Environment variable or CLI flag left empty; endpoint containing whitespace or unescaped characters; config template not substituted (literal '$ENDPOINT'); missing scheme is fine (https:// is prepended) but truly invalid URIs are not.

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/18547272cbbd6195. Report an issue: GitHub.