{"record":{"id":"3cca6774d21ddacd","repo":"lima-vm/lima","slug":"failed-to-run-q-on-q-q-w","errorCode":null,"errorMessage":"failed to run %#q on %#q: %#q: %w","messagePattern":"failed to run %#q on %#q: %#q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/fsutil/fsutil_windows.go","lineNumber":38,"sourceCode":"// specific ssh toolchain should use WindowsSubsystemPathWithCygpath, which\n// runs that toolchain's own cygpath and respects its fstab.\nfunc WindowsSubsystemPath(ctx context.Context, orig string) (string, error) {\n\treturn WindowsSubsystemPathWithCygpath(ctx, \"cygpath\", orig)\n}\n\n// WindowsSubsystemPathWithCygpath converts a Windows path with the given\n// cygpathExe (\"cygpath\" for PATH, or an absolute path to bind the conversion\n// to one Cygwin install). When the cygpath binary is not found it falls back\n// to a native conversion of the absolute drive-letter case; a cygpath that\n// runs and fails returns its error, and non-drive-letter inputs (UNC, device,\n// extended-length) return an error.\nfunc WindowsSubsystemPathWithCygpath(ctx context.Context, cygpathExe, orig string) (string, error) {\n\tout, err := exec.CommandContext(ctx, cygpathExe, filepath.ToSlash(orig)).CombinedOutput()\n\tif err == nil {\n\t\treturn strings.TrimSpace(string(out)), nil\n\t}\n\tif !errors.Is(err, exec.ErrNotFound) && !errors.Is(err, fs.ErrNotExist) {\n\t\treturn \"\", fmt.Errorf(\"failed to run %#q on %#q: %#q: %w\", cygpathExe, orig, strings.TrimSpace(string(out)), err)\n\t}\n\n\tlogrus.WithError(err).Debugf(\"%#q not found for %#q, attempting native conversion\", cygpathExe, orig)\n\n\treturn windowsSubsystemPathWithoutCygpath(orig)\n}\n\nfunc windowsSubsystemPathWithoutCygpath(orig string) (string, error) {\n\t// The /c/... form this produces is the MSYS2 and Git-for-Windows\n\t// convention; stock Cygwin defaults to /cygdrive/c/. Only an absolute\n\t// drive-letter path (\"C:\\foo\") has a well-defined form here. A\n\t// drive-relative path (\"C:foo\") would become an unrelated absolute\n\t// path, so reject it.\n\tif !filepath.IsAbs(orig) {\n\t\treturn \"\", fmt.Errorf(\"cannot convert %#q to an MSYS-style path: input is not an absolute drive-letter path\", orig)\n\t}\n\n\t// UNC path (\"\\\\server\\share\\foo\") is rejected here.","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/fsutil/fsutil_windows.go#L20-L56","documentation":"WindowsSubsystemPathWithCygpath runs the external cygpath.exe to convert a Windows path to its POSIX/subsystem form. When cygpath exits nonzero AND the failure is not simply 'executable not found' (exec.ErrNotFound / fs.ErrNotExist), the raw combined output and error are wrapped in this error. It signals a real cygpath execution failure (bad arguments, corrupted install, permission issues), not a missing tool.","triggerScenarios":"Calling WindowsSubsystemPath (or WithCygpath directly) on Windows when cygpath.exe exists but fails: a broken Cygwin/MSYS2/Git-for-Windows install, wrong cygpathExe path, permission denials, or the target path triggering a cygpath error.","commonSituations":"Users with partially uninstalled or multiple Cygwin/MSYS2/Git installations on Windows; PATH pointing at a stale cygpath.exe; antivirus blocking process spawn.","solutions":["Read the wrapped output in the error to see cygpath's own message and fix the underlying cygpath issue.","Verify the cygpath.exe path is correct and the Cygwin/MSYS2/Git-for-Windows installation is intact (run `cygpath -w .` manually).","Remove stale duplicate cygpath.exe entries from PATH.","If cygpath is genuinely unavailable, note that a not-found error is handled gracefully via the native conversion fallback; this error only fires for other failures.","Check permissions/antivirus if exec itself fails."],"exampleFix":"// before\np, err := fsutil.WindowsSubsystemPathWithCygpath(ctx, cygpathExe, orig)\n// after\np, err := fsutil.WindowsSubsystemPathWithCygpath(ctx, `C:\\Program Files\\Git\\usr\\bin\\cygpath.exe`, orig)\nif err != nil {\n    log.WithError(err).Warn(\"cygpath failed; verify the installation\")\n}","handlingStrategy":"try-catch","validationCode":"if _, err := exec.LookPath(cygpathExe); err != nil {\n    return fmt.Errorf(\"cygpath not available at %q\", cygpathExe)\n}","typeGuard":null,"tryCatchPattern":"p, err := fsutil.WindowsSubsystemPathWithCygpath(ctx, cygpathExe, orig)\nif err != nil {\n    var ee *exec.ExitError\n    if errors.As(err, &ee) {\n        log.Errorf(\"cygpath failed: %v\", ee.Stderr)\n    }\n    return fmt.Errorf(\"path conversion via cygpath failed: %w\", err)\n}","preventionTips":["Validate the cygpath.exe location before calling","Keep a single healthy Cygwin/MSYS2/Git install on PATH","Surface the wrapped combined output to users for diagnosis","Test path conversion on real Windows runners"],"tags":["windows","fsutil","exec","cygpath"],"backgroundTag":"external-command-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}