juicedata/juicefs · error

Invalid host: %s

Error message

Invalid host: %s

What it means

Returned by newSwiftOSS when the endpoint host does not contain a dot separating the container name from the auth host — the Swift endpoint convention is container.authhost, so a single-label host leaves the container undefined.

Source

Thrown at pkg/object/swift.go:141

		"",
	}, 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,
		Transport: httpClient.Transport.(*http.Transport),
	}
	err = conn.Authenticate(context.Background())
	if err != nil {
		return nil, fmt.Errorf("Auth: %s", err)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Format the endpoint as container.auth.domain so the container prefix can be extracted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/object/swift.go:141 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/26746c58aacba943. Report an issue: GitHub.