{"record":{"id":"6ad0b35c85a65004","repo":"juicedata/juicefs","slug":"failed-to-mount-smb-share-s-v","errorCode":null,"errorMessage":"failed to mount SMB share %s: %v","messagePattern":"failed to mount SMB share (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/object/cifs.go","lineNumber":138,"sourceCode":"\t// Establish SMB connection\n\taddress := net.JoinHostPort(c.host, c.port)\n\td := &smb2.Dialer{\n\t\tInitiator: &smb2.NTLMInitiator{\n\t\t\tUser:     c.user,\n\t\t\tPassword: c.password,\n\t\t},\n\t}\n\n\tvar err error\n\tconn.session, err = d.Dial(ctx, address)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"SMB authentication failed: %v\", err)\n\t}\n\n\tconn.share, err = conn.session.WithContext(ctx).Mount(c.share)\n\tif err != nil {\n\t\tc.closeConnection(conn)\n\t\treturn nil, fmt.Errorf(\"failed to mount SMB share %s: %v\", c.share, err)\n\t}\n\n\treturn conn, nil\n}\n\nfunc (c *cifsStore) closeConnection(conn *cifsConn) {\n\tif conn == nil || conn.session == nil {\n\t\treturn\n\t}\n\n\tsession := conn.session\n\tconn.session = nil\n\tconn.share = nil\n\n\t_ = session.WithContext(context.Background()).Logoff()\n}\n\nfunc (c *cifsStore) closeConnectionAsync(conn *cifsConn) {","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/object/cifs.go#L120-L156","documentation":"After the SMB session is authenticated, getConnection mounts the configured share via session.WithContext(ctx).Mount(c.share). If the mount fails (share name wrong, share not exported, insufficient share permissions, tree-connect rejected), the connection is closed and this error is returned naming the share.","triggerScenarios":"conn.session.WithContext(ctx).Mount(c.share) errors: share does not exist on the server, share access denied for the authenticated user, typo in share name, or the server refuses tree connect (e.g. share reached connection limit).","commonSituations":"Share name typo (case-sensitivity on some servers); user lacks share-level ACL permission on Windows/Samba; share renamed or removed; hidden/administrative shares not accessible; too many concurrent connections per user.","solutions":["Verify the share exists: smbclient -L //host -U user lists available shares","Fix the share name in the endpoint (exact name as exported by the server)","Grant the authenticated user share-level and filesystem-level permissions on the share","Check server logs for tree-connect denial reasons (access control, connection limits)"],"exampleFix":"// before\n// smb://fileserver/wrongshare?username=user\n// after\n// smb://fileserver/public?username=user","handlingStrategy":"try-catch","validationCode":"// Shell: confirm the share exists and is accessible\nsmbclient -L //fileserver -U 'DOMAIN\\\\user' | grep -F 'public' || {\n  echo \"share not found\"; exit 1;\n}","typeGuard":null,"tryCatchPattern":"// Go\nobj, err := object.NewCifs(endpoint)\nif err != nil && strings.Contains(err.Error(), \"failed to mount SMB share\") {\n    // verify share name and share-level permissions server-side\n}","preventionTips":["List shares with smbclient -L and copy exact share names into config","Grant the connecting user both share ACL and filesystem permissions","Alert on share renames/removals in the storage admin process"],"tags":["object-storage","smb","cifs","mount"],"backgroundTag":"resource-not-found","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"}