{"record":{"id":"afd43f154cfbaaeb","repo":"juicedata/juicefs","slug":"parse-s-s","errorCode":null,"errorMessage":"parse %s: %s","messagePattern":"parse (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/tkv_etcd.go","lineNumber":320,"sourceCode":"\tq := u.Query()\n\ttsinfo.CAFile = q.Get(\"cacert\")\n\ttsinfo.CertFile = q.Get(\"cert\")\n\ttsinfo.KeyFile = q.Get(\"key\")\n\ttsinfo.ServerName = q.Get(\"server-name\")\n\ttsinfo.InsecureSkipVerify = q.Get(\"insecure-skip-verify\") != \"\"\n\tif tsinfo.CAFile != \"\" || tsinfo.CertFile != \"\" || tsinfo.KeyFile != \"\" || tsinfo.ServerName != \"\" {\n\t\treturn tsinfo.ClientConfig()\n\t}\n\treturn nil, nil\n}\n\nfunc newEtcdClient(addr string) (tkvClient, error) {\n\tif !strings.Contains(addr, \"://\") {\n\t\taddr = \"http://\" + addr\n\t}\n\tu, err := url.Parse(addr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse %s: %s\", addr, err)\n\t}\n\tpasswd, _ := u.User.Password()\n\thosts := strings.Split(u.Host, \",\")\n\tfor i, h := range hosts {\n\t\th, _, err := net.SplitHostPort(h)\n\t\tif err != nil {\n\t\t\thosts[i] = net.JoinHostPort(h, \"2379\")\n\t\t}\n\t}\n\tconf := etcd.Config{\n\t\tEndpoints:        hosts,\n\t\tUsername:         u.User.Username(),\n\t\tPassword:         passwd,\n\t\tAutoSyncInterval: time.Minute,\n\t}\n\tconf.TLS, err = buildTlsConfig(u)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"build tls config from %s: %s\", u.RawQuery, err)","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/tkv_etcd.go#L302-L338","documentation":"`newEtcdClient` parses the metadata URL with `net/url` after defaulting the scheme to http. If the address cannot be parsed (malformed URL syntax), construction fails with 'parse %s: %s'. This happens before any network connection is made.","triggerScenarios":"`juicefs mount ... etcd://<addr>` (or `etcd` scheme metadata URL) where the address after scheme handling is not a valid URL — bad characters, missing host, invalid userinfo, unescaped percent signs.","commonSituations":"Typo in the metadata URL; unescaped special characters (`@`, `:`, spaces) in host or password; passing a bare hostname with stray characters; quoting issues from shell escaping.","solutions":["Print and inspect the exact metadata URL argument being passed to the command","Percent-encode special characters in userinfo (password) and use `host:port` comma-separated endpoints without stray characters","Test parsing locally: `python3 -c \"import urllib.parse;urllib.parse.urlparse('<your-url>')\"` or curl equivalent","Correct the URL and rerun the command"],"exampleFix":"// before\njuicefs mount 'etcd://host1:2379,host2:2379 p@ss@/prefix' /mnt/jfs\n// after\njuicefs mount 'etcd://user:p%40ss@host1:2379,host2:2379/prefix' /mnt/jfs","handlingStrategy":"validation","validationCode":"// Validate the metadata URL before invoking juicefs\nfrom urllib.parse import urlparse\nu = urlparse(meta_url)\nassert u.scheme == 'etcd' or '://' in meta_url, f'invalid etcd metadata URL: {meta_url}'\nassert u.hostname, f'missing host in URL: {meta_url}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote URLs in shell to avoid stray characters and escaping surprises","Percent-encode userinfo passwords","Use host:port[,host:port] endpoint lists with no whitespace","Smoke-test the URL with a tiny mount into /tmp first"],"tags":["etcd","url","config","juicefs"],"backgroundTag":"invalid-url","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}