benbjohnson/litestream · error
cannot specify url & webdav-url for webdav replica
Error message
cannot specify url & webdav-url for webdav replica
What it means
newWebDAVReplicaClientFromConfig rejects configs with both 'url' and 'webdav-url' set. Both describe the WebDAV server endpoint, so having both is contradictory; the constructor returns this validation error during replica client creation.
Source
Thrown at cmd/litestream/main.go:1864
client.Path = path
client.KeyPath = c.KeyPath
client.HostKey = c.HostKey
// Set concurrent writes if specified, otherwise use default (true)
if c.ConcurrentWrites != nil {
client.ConcurrentWrites = *c.ConcurrentWrites
}
return client, nil
}
// newWebDAVReplicaClientFromConfig returns a new instance of webdav.ReplicaClient built from config.
func newWebDAVReplicaClientFromConfig(c *ReplicaConfig, _ *litestream.Replica) (_ *webdav.ReplicaClient, err error) {
// Ensure URL & constituent parts are not both specified.
if c.URL != "" && c.Path != "" {
return nil, fmt.Errorf("cannot specify url & path for webdav replica")
} else if c.URL != "" && c.WebDAVURL != "" {
return nil, fmt.Errorf("cannot specify url & webdav-url for webdav replica")
}
webdavURL, username, password, path := c.WebDAVURL, c.WebDAVUsername, c.WebDAVPassword, c.Path
// Apply settings from URL, if specified.
if c.URL != "" {
u, err := url.Parse(c.URL)
if err != nil {
return nil, err
}
// Build WebDAV URL from scheme and host
scheme := "http"
if u.Scheme == "webdavs" {
scheme = "https"
}
if webdavURL == "" && u.Host != "" {
webdavURL = fmt.Sprintf("%s://%s", scheme, u.Host)View on GitHub (pinned to 4ed7a308f6)
Solutions
- Remove 'webdav-url' and keep only 'url'
- Or remove 'url' and use webdav-url + username + password + path fields
- Pick one style and apply it consistently across all replicas in the config
Example fix
# before - type: webdav url: webdavs://dav.example.com/db webdav-url: https://dav.example.com # after - type: webdav url: webdavs://dav.example.com/db
Defensive patterns
Strategy: validation
Validate before calling
if rep.Type == "webdav" && rep.URL != "" && rep.WebDAVURL != "" {
return fmt.Errorf("webdav replica %s: url and webdav-url are mutually exclusive", rep.Name)
} Prevention
- Use 'url' as the single source for endpoint in new configs
- Keep only webdav-url in legacy configs; never mix
- Review migrations for dual endpoint keys
When it happens
Trigger: A webdav replica config with c.URL non-empty (e.g. 'webdavs://dav.example.com/db') and c.WebDAVURL also non-empty (e.g. webdav-url: https://dav.example.com).
Common situations: Mixing two documentation styles in one config; a migration tool that maps old 'webdav-url' fields and adds a new 'url' field without removing the original.
Related errors
- cannot specify url & path for webdav replica
- webdav-url required for webdav replica
- database config #%d: 'watch' can only be enabled with a dire
- database config #%d: 'meta-dir' can only be used with a dire
- database config #%d: cannot specify both 'meta-path' and 'me
AI-assisted analysis of benbjohnson/litestream@4ed7a308f6 (2026-09-06).
Data as JSON: /api/errors/626dbf7d79ce025e.
Report an issue: GitHub.