juicedata/juicefs · error

Invalid endpoint %s: %s

Error message

Invalid endpoint %s: %s

What it means

url.ParseRequestURI rejected the WebDAV endpoint after defaulting to an http:// prefix. Validation guard: the server address is not a well-formed URI (missing host, invalid characters), so the gowebdav client cannot be created.

Source

Thrown at pkg/object/webdav.go:184

			info.ModTime(),
			info.IsDir(),
			"",
			"",
		})
		if len(objs) == int(limit) {
			break
		}
	}
	return generateListResult(objs, limit)
}

func newWebDAV(endpoint, user, passwd, 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.Path == "" {
		uri.Path = "/"
	}
	c := gowebdav.NewClient(uri.String(), user, passwd)
	c.SetTransport(httpClient.Transport)
	c.SetHeader("User-Agent", UserAgent)
	return &webdav{endpoint: uri, c: c}, nil
}

func init() {
	Register("webdav", newWebDAV)
}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Echo the endpoint and strip whitespace/quotes/control characters
  2. Provide a valid host[:port][/path], e.g. dav.example.com:5005 or http://dav.example.com
  3. Ensure variables in the config are actually expanded
  4. Percent-encode special characters where needed

Example fix

// before
webdav://my server/dav
// after
webdav://my-server/dav
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

_, err := object.CreateStorage(ctx, "webdav", url, user, pass)
if err != nil && strings.HasPrefix(err.Error(), "Invalid endpoint") {
	// fix endpoint and retry
}

Prevention

When it happens

Trigger: WebDAV storage URL whose endpoint is empty, contains illegal characters/whitespace, or is otherwise rejected by ParseRequestURI (e.g. "http://host with space", control characters).

Common situations: Unexpanded shell variables in the endpoint; spaces or quotes pasted in; missing host (e.g. just a path); wrong port syntax like "://host:notaport".

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/4e55a54a3e58413f. Report an issue: GitHub.