{"record":{"id":"292b299b5450f077","repo":"juicedata/juicefs","slug":"can-t-create-connection-to-cluster-s-for-user-s","errorCode":null,"errorMessage":"Can't create connection to cluster %s for user %s: %s","messagePattern":"Can't create connection to cluster (.+?) for user (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/ceph.go","lineNumber":341,"sourceCode":"\t\t\tconds[j].Signal()\n\t\t\tms[j].Unlock()\n\t\t}\n\t}()\n\treturn objs, nil\n}\n\nfunc newCeph(endpoint, cluster, user, token string) (ObjectStorage, error) {\n\tif !strings.Contains(endpoint, \"://\") {\n\t\tendpoint = fmt.Sprintf(\"ceph://%s\", endpoint)\n\t}\n\turi, err := url.ParseRequestURI(endpoint)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Invalid endpoint %s: %s\", endpoint, err)\n\t}\n\tname := uri.Host\n\tconn, err := rados.NewConnWithClusterAndUser(cluster, user)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Can't create connection to cluster %s for user %s: %s\", cluster, user, err)\n\t}\n\tif opt := os.Getenv(\"CEPH_ADMIN_SOCKET\"); opt != \"none\" {\n\t\tif opt == \"\" {\n\t\t\topt = \"$run_dir/jfs-$cluster-$name-$pid.asok\"\n\t\t}\n\t\tif err = conn.SetConfigOption(\"admin_socket\", opt); err != nil {\n\t\t\tlogger.Warnf(\"Failed to set admin_socket to %s: %s\", opt, err)\n\t\t}\n\t}\n\tif opt := os.Getenv(\"CEPH_LOG_FILE\"); opt != \"none\" {\n\t\tif opt == \"\" {\n\t\t\topt = \"/var/log/ceph/jfs-$cluster-$name.log\"\n\t\t}\n\t\tif err = conn.SetConfigOption(\"log_file\", opt); err != nil {\n\t\t\tlogger.Warnf(\"Failed to set log_file to %s: %s\", opt, err)\n\t\t}\n\t}\n\tif err := conn.ReadDefaultConfigFile(); err != nil {","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/ceph.go#L323-L359","documentation":"newCeph creates a RADOS connection handle via go-ceph's rados.NewConnWithClusterAndUser(cluster, user). If the connection object cannot be created (bad cluster/user parameter combos, missing ceph libraries/config), construction fails with this message.","triggerScenarios":"rados.NewConnWithClusterAndUser returns an error — typically an invalid cluster name or user string, or the underlying librados failing to initialize for the given cluster/user pair.","commonSituations":"Wrong --ceph-cluster or --ceph-user values; user name typo (e.g. missing \".client\" suffix conventions); librados not installed or version mismatch in the environment.","solutions":["Verify cluster and user names match your Ceph deployment (e.g. cluster \"ceph\", user \"client.admin\")","Ensure librados is installed and compatible (build with ceph tag supported on your platform)","Test connectivity with `ceph --cluster <cluster> --name <user> -s` before mounting","Check CEPH_CONF environment variable points to a valid config"],"exampleFix":"// before\nnewCeph(\"mon1\", \"wrongcluster\", \"admin\", \"\")\n// after\nnewCeph(\"mon1\", \"ceph\", \"client.admin\", \"\")","handlingStrategy":"validation","validationCode":"// Shell: verify cluster/user before starting\nceph --cluster \"$CEPH_CLUSTER\" --name \"$CEPH_USER\" -s >/dev/null || {\n  echo \"cannot talk to cluster as $CEPH_USER\"; exit 1;\n}","typeGuard":null,"tryCatchPattern":"// Go\nobj, err := object.NewCeph(endpoint, cluster, user, \"\")\nif err != nil && strings.Contains(err.Error(), \"Can't create connection\") {\n    // check librados availability and cluster/user params\n}","preventionTips":["Pin a compatible librados version on client hosts","Match cluster/user names exactly to your Ceph deployment (\"ceph\", \"client.admin\")","Smoke-test with `ceph -s` before launching the JuiceFS client"],"tags":["object-storage","ceph","rados","connection"],"backgroundTag":"connection-refused","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"}