juicedata/juicefs · error

Invalid uri.Scheme: %s

Error message

Invalid uri.Scheme: %s

What it means

The Swift endpoint parsed successfully but its URI scheme is neither http nor https. Validation guard rejecting non-plaintext-transport schemes, since the Swift client only supports HTTP(S) endpoints.

Source

Thrown at pkg/object/swift.go:136

		key,
		object.Bytes,
		object.LastModified,
		strings.HasSuffix(key, "/"),
		"",
		"",
	}, err
}

func newSwiftOSS(endpoint, username, apiKey, token string) (ObjectStorage, error) {
	if !strings.Contains(endpoint, "://") {
		endpoint = fmt.Sprintf("http://%s", endpoint)
	}
	uri, err := url.ParseRequestURI(endpoint)
	if err != nil {
		return nil, fmt.Errorf("Invalid endpoint %s: %s", endpoint, err)
	}
	if uri.Scheme != "http" && uri.Scheme != "https" {
		return nil, fmt.Errorf("Invalid uri.Scheme: %s", uri.Scheme)
	}

	hostSlice := strings.SplitN(uri.Host, ".", 2)
	if len(hostSlice) != 2 {
		return nil, fmt.Errorf("Invalid host: %s", uri.Host)
	}
	container := hostSlice[0]
	host := hostSlice[1]

	// current only support V1 authentication
	authURL := uri.Scheme + "://" + host + "/auth/v1.0"

	conn := swift.Connection{
		UserName:  username,
		ApiKey:    apiKey,
		AuthToken: token,
		AuthUrl:   authURL,
		UserAgent: UserAgent,

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Use an http:// or https:// Swift endpoint
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/object/swift.go:136 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/fc60940436af861d. Report an issue: GitHub.