{"record":{"id":"eac9e98e5e59f4d4","repo":"juicedata/juicefs","slug":"invalid-uri-s","errorCode":null,"errorMessage":"invalid uri: %s","messagePattern":"invalid uri: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/interface.go","lineNumber":596,"sourceCode":"\tSlices        map[Ino][]Slice\n}\n\ntype CleanupTrashStats struct {\n\tDeletedFiles int64\n}\n\ntype Creator func(driver, addr string, conf *Config) (Meta, error)\n\nvar metaDrivers = make(map[string]Creator)\n\nfunc Register(name string, register Creator) {\n\tmetaDrivers[name] = register\n}\n\nfunc injectPasswordIntoURI(uri, password string) (string, error) {\n\tatIndex := strings.LastIndex(uri, \"@\")\n\tif atIndex == -1 {\n\t\treturn \"\", fmt.Errorf(\"invalid uri: %s\", uri)\n\t}\n\tdIndex := strings.Index(uri, \"://\") + 3\n\ts := strings.Split(uri[dIndex:atIndex], \":\")\n\n\tif len(s) > 2 {\n\t\treturn \"\", fmt.Errorf(\"invalid uri: %s\", uri)\n\t}\n\n\tif len(s) == 2 && s[1] != \"\" {\n\t\treturn uri, nil\n\t}\n\tpwd := url.UserPassword(\"\", password) // escape only password\n\treturn uri[:dIndex] + s[0] + pwd.String() + uri[atIndex:], nil\n}\n\nfunc readPasswordFromFile(filePath string) (string, error) {\n\tcontent, err := os.ReadFile(filePath)\n\tif err != nil {","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/interface.go#L578-L614","documentation":"Returned by injectPasswordIntoURI when the metadata URL contains no '@' separator, i.e. there is no userinfo section into which a password could be injected. The URI is structurally invalid for credential injection.","triggerScenarios":"setPasswordFromEnv / password injection is invoked (e.g. --password or password env var set) with a metadata URI lacking a userinfo '@', such as `redis://localhost:6379/1`.","commonSituations":"Setting JFS_*_PASSWORD or passing --password while the URL omits a user@host part; copy-pasting a connection string without credentials and expecting the tool to inject them.","solutions":["Include a user (and empty password) in the URI before '@', e.g. `redis://:PASSWORD@host:6379/1` or `redis://default@host:6379/1`.","Remove the --password/env password so no injection is attempted and embed credentials directly in the URI.","Double-check the URI has no typos that removed the '@' (e.g. shell mangling of special characters)."],"exampleFix":"// before\n--meta redis://localhost:6379/1 --password secretpw\n// after\n--meta redis://default@localhost:6379/1 --password secretpw","handlingStrategy":"validation","validationCode":"case \"$META_URL\" in *@*) echo ok;; *) echo \"URI missing user@host part\";; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include user@host in metadata URIs when using --password.","Quote URIs in shell scripts to avoid character mangling.","Document credential-injection requirements in deployment templates."],"tags":["uri","password","metadata-url"],"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"}