juicedata/juicefs · error
failed to exec command line: %s, %s
Error message
failed to exec command line: %s, %s
What it means
findMountProcess executes `wmic process where name='<juicefs.exe>' get CommandLine,ProcessId` to enumerate candidate mount processes. If exec.CombinedOutput returns a non-nil error (wmic not found, failed to launch, or exited non-zero), the error is wrapped with the full command string.
Source
Thrown at cmd/debug_windows.go:63
}
for _, line := range lines[1:] {
sline := strings.TrimSpace(line)
if sline == "" {
continue
}
return sline, nil
}
return "", fmt.Errorf("cannot find command line for pid %d. If the juicefs are mounted at background, Please rerun this with the admin permission.", pid)
}
func findMountProcess(mp string) (int, error) {
processName := filepath.Base(os.Args[0])
cmd := exec.Command("wmic", "process", "where", fmt.Sprintf("name='%s'", processName), "get", "CommandLine,ProcessId")
out, err := cmd.CombinedOutput()
if err != nil {
return 0, fmt.Errorf("failed to exec command line: %s, %s", cmd.String(), err)
}
lines := strings.Split(string(out), "\r\n")
if len(lines) < 2 {
return 0, fmt.Errorf("failed to find mount process")
}
mp = strings.TrimRight(mp, "\\")
for _, line := range lines[1:] {
sline := strings.TrimSpace(line)
if sline == "" {
continue
}
// the first part of commandline contains 'xxx/mount.exe"'
slines := strings.SplitN(sline, ".exe\" ", 2)
if len(slines) < 2 {
View on GitHub (pinned to c9a67b23e8)
Solutions
- Install WMIC via Windows Features on Demand: `DISM /Online /Add-Capability /CapabilityName:WMIC~~~~` or re-enable it in Optional Features
- Verify WMI works: run the wmic query manually; if WMI is corrupt, rebuild the repository (`winmgmt /resetrepository`)
- Upgrade JuiceFS to a release that uses PowerShell `Get-CimInstance` instead of wmic
- Ensure system32 is on PATH and the shell can execute wmic.exe
Defensive patterns
Strategy: try-catch
Validate before calling
// check wmic availability before invoking debug paths that rely on it
if _, err := exec.LookPath("wmic"); err != nil {
return fmt.Errorf("wmic not available; install WMIC or use a newer JuiceFS build")
} Try / catch
_, pid, _, err := getCmdMount(mp)
if err != nil {
if strings.Contains(err.Error(), "failed to exec command line") {
// wmic missing/broken: prompt install or fall back to config-file pid
}
return err
} Prevention
- Pre-release checks: ensure wmic.exe exists on target Windows images (deprecated in Windows 11 24H2+)
- Keep WMI healthy; avoid disabling the Windows Management Instrumentation service
- Pin the pid via the mount config (readConfig) so findMountProcess/wmic is not needed
- Upgrade to JuiceFS builds that use PowerShell Get-CimInstance instead of wmic
When it happens
Trigger: `juicefs debug <mountpoint>` with no pid available in the mount config calls findMountProcess; the wmic executable cannot be started (not installed / not on PATH, e.g. Windows 11 24H2+ where WMIC is deprecated) or the WMI service is broken and the query exits non-zero.
Common situations: Running on Windows 11 24H2 or Server editions where WMIC was removed; WMI repository corruption; PATH or system32 issues; running inside a restricted container/sandbox without WMI access.
Related errors
- failed to find command line for pid: %d
- cannot find command line for pid %d. If the juicefs are moun
- failed to find mount process
- failed to run command line: %s, %v
- failed to parse pid: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/275b19f7b2dda30e.
Report an issue: GitHub.