{"record":{"id":"f45ebfd5ddaff2df","repo":"juicedata/juicefs","slug":"invalid-scheme-s-should-be-cifs-or-smb","errorCode":null,"errorMessage":"invalid scheme %s, should be cifs:// or smb://","messagePattern":"invalid scheme (.+?), should be cifs:// or smb://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/cifs.go","lineNumber":482,"sourceCode":"func (c *cifsStore) Copy(ctx context.Context, dst, src string) error {\n\tr, err := c.Get(ctx, src, 0, -1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer r.Close()\n\treturn c.Put(ctx, dst, r)\n}\n\nfunc parseEndpoint(endpoint string) (host, port, share string, err error) {\n\tif !strings.Contains(endpoint, \"://\") {\n\t\tendpoint = \"cifs://\" + endpoint\n\t}\n\tu, err := url.Parse(endpoint)\n\tif err != nil {\n\t\treturn\n\t}\n\tif u.Scheme != \"\" && (u.Scheme != \"cifs\" && u.Scheme != \"smb\") {\n\t\terr = fmt.Errorf(\"invalid scheme %s, should be cifs:// or smb://\", u.Scheme)\n\t\treturn\n\t}\n\n\thost = u.Hostname()\n\tport = u.Port()\n\tif port == \"\" {\n\t\tport = \"445\" // Default SMB port\n\t}\n\tparts := strings.Split(u.Path, \"/\")\n\tif len(parts) < 2 || parts[1] == \"\" {\n\t\terr = fmt.Errorf(\"endpoint should be a valid share name (%s)\", \"\\\\\\\\<server>\\\\<share>\")\n\t\treturn\n\t}\n\tif len(parts) > 2 && parts[2] != \"\" {\n\t\terr = fmt.Errorf(\"endpoint should be a valid share name (%s)\", \"\\\\\\\\<server>\\\\<share>\")\n\t\treturn\n\t}\n\tshare = parts[1]","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/cifs.go#L464-L500","documentation":"parseEndpoint in pkg/object/cifs.go validates the CIFS endpoint URL. If a scheme is present but is neither \"cifs\" nor \"smb\", the endpoint cannot be interpreted as a CIFS/SMB address, so newCifs refuses to build the storage backend. This prevents silently treating an http:// or ftp:// URL as an SMB share.","triggerScenarios":"Calling newCifs (e.g. via juicefs object storage 'cifs' URI) with an endpoint like \"http://server/share\" or \"ftp://host/share\"; any non-empty u.Scheme that is not cifs or smb after url.Parse.","commonSituations":"Copy-pasting an HTTP URL of a file share instead of the SMB path; typos like \"smbb://server/share\"; tooling that auto-prefixes a wrong scheme; mixing up WebDAV/HTTP shares with SMB shares.","solutions":["Use cifs://server/share or smb://server/share as the endpoint (the scheme is optional; a bare \\\\<server>\\<share> or server/share also works).","Fix any typo in the scheme so it is exactly \"cifs\" or \"smb\" (lowercase).","If the share is actually served over HTTP/WebDAV, switch to the corresponding object storage/webdav driver instead of cifs."],"exampleFix":"// before\nnewCifs(\"http://fileserver/myshare\", ...)\n// after\nnewCifs(\"cifs://fileserver/myshare\", ...)","handlingStrategy":"validation","validationCode":"u, err := url.Parse(endpoint)\nif err == nil && u.Scheme != \"\" && u.Scheme != \"cifs\" && u.Scheme != \"smb\" {\n    return fmt.Errorf(\"endpoint scheme %q not supported; use cifs:// or smb://\", u.Scheme)\n}","typeGuard":"func isValidCifsScheme(endpoint string) bool {\n    u, err := url.Parse(endpoint)\n    return err == nil && (u.Scheme == \"\" || u.Scheme == \"cifs\" || u.Scheme == \"smb\")\n}","tryCatchPattern":"obj, err := object.CreateStorage(\"cifs\", endpoint, ak, sk, \"\")\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid scheme\") {\n        // normalize endpoint: strip or fix scheme, then retry\n    }\n}","preventionTips":["Validate the storage URI scheme before constructing the backend","Use lowercase, exact scheme names cifs or smb","Prefer the documented \\\\<server>\\<share> or cifs://server/share formats"],"tags":["cifs","smb","url-validation","config"],"backgroundTag":"invalid-url-format","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}