{"record":{"id":"f93822413e53d053","repo":"benbjohnson/litestream","slug":"webdav-url-required-for-webdav-replica","errorCode":null,"errorMessage":"webdav-url required for webdav replica","messagePattern":"webdav-url required for webdav replica","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/litestream/main.go","lineNumber":1899,"sourceCode":"\t\tif webdavURL == \"\" && u.Host != \"\" {\n\t\t\twebdavURL = fmt.Sprintf(\"%s://%s\", scheme, u.Host)\n\t\t}\n\n\t\t// Extract credentials from URL\n\t\tif username == \"\" && u.User != nil {\n\t\t\tusername = u.User.Username()\n\t\t}\n\t\tif password == \"\" && u.User != nil {\n\t\t\tpassword, _ = u.User.Password()\n\t\t}\n\t\tif path == \"\" {\n\t\t\tpath = u.Path\n\t\t}\n\t}\n\n\t// Ensure required settings are set.\n\tif webdavURL == \"\" {\n\t\treturn nil, fmt.Errorf(\"webdav-url required for webdav replica\")\n\t}\n\n\t// Build replica.\n\tclient := webdav.NewReplicaClient()\n\tclient.URL = webdavURL\n\tclient.Username = username\n\tclient.Password = password\n\tclient.Path = path\n\n\treturn client, nil\n}\n\n// newNATSReplicaClientFromConfig returns a new instance of nats.ReplicaClient built from config.\nfunc newNATSReplicaClientFromConfig(c *ReplicaConfig, _ *litestream.Replica) (_ *nats.ReplicaClient, err error) {\n\t// Parse URL if provided to extract bucket name and server URL\n\tvar url, bucket string\n\tif c.URL != \"\" {\n\t\tscheme, host, bucketPath, err := litestream.ParseReplicaURL(c.URL)","sourceCodeStart":1881,"sourceCodeEnd":1917,"githubUrl":"https://github.com/benbjohnson/litestream/blob/4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3/cmd/litestream/main.go#L1881-L1917","documentation":"newWebDAVReplicaClientFromConfig requires the WebDAV server endpoint. If neither 'webdav-url' nor a URL with a usable host component yielded a non-empty webdavURL, the client cannot reach any server and this error is returned at startup.","triggerScenarios":"A webdav replica with no 'webdav-url' and a 'url' whose host part is empty (e.g. 'webdav:///db' or a bare 'webdav://'), so webdavURL stays empty after URL application.","commonSituations":"Config assembled from env vars where the server address variable was empty; typo'd scheme like 'webdav:db' with no authority component; partially filled webdav block with only credentials.","solutions":["Add 'webdav-url: https://<dav-server>' to the webdav replica config","Or provide a complete URL with host: 'url: webdavs://dav.example.com/db'","Check env expansion: ensure the variable holding the server address is set in the litestream process environment"],"exampleFix":"# before\n- type: webdav\n  username: backup\n  password: secret\n  path: /db\n# after\n- type: webdav\n  webdav-url: https://dav.example.com\n  username: backup\n  password: secret\n  path: /db","handlingStrategy":"validation","validationCode":"if rep.Type == \"webdav\" {\n    endpoint := rep.WebDAVURL\n    if endpoint == \"\" && rep.URL != \"\" {\n        if u, err := url.Parse(rep.URL); err == nil && u.Host != \"\" { endpoint = u.Scheme + \"://\" + u.Host }\n    }\n    if endpoint == \"\" { return fmt.Errorf(\"webdav replica %s: missing webdav-url\", rep.Name) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set webdav-url (or a url with host) for webdav replicas","Verify env-expanded values are non-empty at startup","Test-parse the URL scheme (webdav/webdavs) before deploying"],"tags":["config","webdav","litestream","validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"4ed7a308f6271ebfd2b0a6e4b70b03011a37e4a3","analyzedAt":"2026-09-06T18:29:25.564Z","contentChangedAt":"2026-09-06T18:29:25.564Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}