{"record":{"id":"a436af32a761b6c3","repo":"IceWhaleTech/CasaOS","slug":"get-mount-list-failed","errorCode":null,"errorMessage":"get mount list failed","messagePattern":"get mount list failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/utils/httper/drive.go","lineNumber":71,"sourceCode":"\t\t\treturn net.Dial(\"unix\", unixSocket)\n\t\t},\n\t}\n\n\tclient := resty.New()\n\n\tclient.SetTransport(&transport).SetBaseURL(\"http://localhost\")\n\tclient.SetRetryCount(3).SetRetryWaitTime(5*time.Second).SetTimeout(DefaultTimeout).SetHeader(\"User-Agent\", UserAgent)\n\treturn client\n}\n\nfunc GetMountList() (MountList, error) {\n\tvar result MountList\n\tres, err := NewRestyClient().R().Post(\"/mount/listmounts\")\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tif res.StatusCode() != 200 {\n\t\treturn result, fmt.Errorf(\"get mount list failed\")\n\t}\n\tjson.Unmarshal(res.Body(), &result)\n\tfor i := 0; i < len(result.MountPoints); i++ {\n\t\tresult.MountPoints[i].Fs = result.MountPoints[i].Fs[:len(result.MountPoints[i].Fs)-1]\n\t}\n\treturn result, err\n}\n\nfunc Mount(mountPoint string, fs string) error {\n\tres, err := NewRestyClient().R().SetFormData(map[string]string{\n\t\t\"mountPoint\": mountPoint,\n\t\t\"fs\":         fs,\n\t\t\"mountOpt\":   `{\"AllowOther\": true}`,\n\t\t\"vfsOpt\":     `{\"CacheMode\": 3}`,\n\t}).Post(\"/mount/mount\")\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/IceWhaleTech/CasaOS/blob/0d3b2f444ec0193193cf03eef6d43c6e35b0183e/pkg/utils/httper/drive.go#L53-L89","documentation":"GetMountList POSTs to /mount/listmounts over a Unix-domain socket (/var/run/rclone/rclone.sock) to a local rclone daemon; any non-200 status (404 unknown route, 500 daemon error, 503 during startup) is collapsed into 'get mount list failed'. Note the daemon is retried 3 times with 5s waits before this surfaces, and the response body — which contains the real reason — is discarded.","triggerScenarios":"The rclone serve daemon behind the socket is down, an incompatible rclone version without the /mount/listmounts endpoint, the rclone service still starting (socket exists but HTTP not ready), or the mount subsystem in an error state returning 5xx.","commonSituations":"Fresh install where rclone service is not yet running; rclone upgraded/downgraded to a version without the mount API; service crashed leaving a stale socket file; insufficient permissions on the socket.","solutions":["Verify the rclone daemon is up: systemctl status rclone (or equivalent) and check the socket exists with ss -x | grep rclone.","Restart the rclone service so the socket and HTTP listener are recreated cleanly (removes stale sockets).","Confirm the installed rclone version exposes /mount/listmounts (test: curl --unix-socket /var/run/rclone/rclone.sock -X POST http://localhost/mount/listmounts).","Include res.Body() in the error message to surface the daemon's actual response for debugging."],"exampleFix":"// before\nif res.StatusCode() != 200 {\n\treturn result, fmt.Errorf(\"get mount list failed\")\n}\n\n// after\nif res.StatusCode() != 200 {\n\treturn result, fmt.Errorf(\"get mount list failed: status %d, body %s\", res.StatusCode(), res.String())\n}","handlingStrategy":"retry","validationCode":"func rcloneSocketReady() bool {\n\t_, err := os.Stat(\"/var/run/rclone/rclone.sock\")\n\treturn err == nil\n}\n\nif !rcloneSocketReady() {\n\treturn errors.New(\"rclone daemon not running; start the rclone service\")\n}","typeGuard":null,"tryCatchPattern":"list, err := httper.GetMountList()\nif err != nil {\n\tif strings.Contains(err.Error(), \"get mount list failed\") {\n\t\t// resty already retried 3x with 5s waits — additional immediate retries are futile;\n\t\t// check service status, restart rclone, then retry once\n\t\tif svcErr := restartRcloneService(); svcErr != nil { return svcErr }\n\t\ttime.Sleep(2 * time.Second)\n\t\treturn httper.GetMountList()\n\t}\n\treturn err\n}","preventionTips":["Order service startup so the rclone daemon is healthy before dependents call GetMountList","Health-check the unix socket and endpoint at boot and on failure","Include status code and body in the error to avoid blind debugging","Remove stale socket files on service restart"],"tags":["rclone","mount","unix-socket","service-unavailable"],"backgroundTag":null,"analyzedSha":"0d3b2f444ec0193193cf03eef6d43c6e35b0183e","analyzedAt":"2026-08-15T13:27:57.821Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}