{"record":{"id":"2b91ffd0575e0ed7","repo":"juicedata/juicefs","slug":"failed-to-find-mount-process","errorCode":null,"errorMessage":"failed to find mount process","messagePattern":"failed to find mount process","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/debug_windows.go","lineNumber":68,"sourceCode":"\t\t\tcontinue\r\n\t\t}\r\n\t\treturn sline, nil\r\n\t}\r\n\r\n\treturn \"\", fmt.Errorf(\"cannot find command line for pid %d. If the juicefs are mounted at background, Please rerun this with the admin permission.\", pid)\r\n}\r\n\r\nfunc findMountProcess(mp string) (int, error) {\r\n\tprocessName := filepath.Base(os.Args[0])\r\n\tcmd := exec.Command(\"wmic\", \"process\", \"where\", fmt.Sprintf(\"name='%s'\", processName), \"get\", \"CommandLine,ProcessId\")\r\n\tout, err := cmd.CombinedOutput()\r\n\tif err != nil {\r\n\t\treturn 0, fmt.Errorf(\"failed to exec command line: %s, %s\", cmd.String(), err)\r\n\t}\r\n\r\n\tlines := strings.Split(string(out), \"\\r\\n\")\r\n\tif len(lines) < 2 {\r\n\t\treturn 0, fmt.Errorf(\"failed to find mount process\")\r\n\t}\r\n\r\n\tmp = strings.TrimRight(mp, \"\\\\\")\r\n\tfor _, line := range lines[1:] {\r\n\t\tsline := strings.TrimSpace(line)\r\n\r\n\t\tif sline == \"\" {\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\t// the first part of commandline contains 'xxx/mount.exe\"'\r\n\t\tslines := strings.SplitN(sline, \".exe\\\" \", 2)\r\n\t\tif len(slines) < 2 {\r\n\t\t\tlogger.Warnf(\"failed to split command line: %s\", sline)\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\tsline = slines[1]\r","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/debug_windows.go#L50-L86","documentation":"After running the wmic process query, findMountProcess splits the output on \\r\\n and expects a header line plus at least one data line. If the output has fewer than 2 lines, no process with the juicefs executable name was found, so no mount process exists for the given mountpoint.","triggerScenarios":"`juicefs debug <mountpoint>` falls back to findMountProcess (no pid in config); wmic returns only a header (or empty) because no process named like os.Args[0] (juicefs.exe) is currently running, meaning the volume is not mounted or the mount process has died.","commonSituations":"Running `juicefs debug` on a mountpoint that was never mounted or whose mount already exited; running debug with a differently-named binary (renamed juicefs.exe) than the one used to mount; wmic silently returning nothing due to permission limits.","solutions":["Verify the mount is running: check `tasklist | findstr juicefs` or the drive in Explorer; mount first if not mounted","Run `juicefs debug` from an elevated prompt so wmic can list processes from other sessions","Ensure the debug command uses the same binary name as the running mount process (findMountProcess matches filepath.Base(os.Args[0]))","If the mount runs under another user, restart debug in that user's context or as admin"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure a mount process for this binary exists before debugging\nout, _ := exec.Command(\"tasklist\", \"/FI\", fmt.Sprintf(\"IMAGENAME eq %s\", filepath.Base(os.Args[0]))).CombinedOutput()\nif !strings.Contains(strings.ToLower(string(out)), strings.ToLower(filepath.Base(os.Args[0]))) {\n\treturn fmt.Errorf(\"no running %s process; is the volume mounted?\", filepath.Base(os.Args[0]))\n}","typeGuard":null,"tryCatchPattern":"_, pid, _, err := getCmdMount(mp)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to find mount process\") {\n\t\t// volume not mounted or mount died: instruct user to mount first\n\t}\n\treturn err\n}","preventionTips":["Run `juicefs debug` only on a mountpoint that is currently mounted","Use the same binary (same name) for debug as the one used to mount — the search matches filepath.Base(os.Args[0])","Run elevated so wmic can enumerate processes of all sessions/users","Confirm the drive appears mounted in Explorer/tasklist before debugging"],"tags":["windows","wmic","process-not-found","process-introspection"],"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"}