lima-vm/lima · error
failed to run %#q on %#q: %#q: %w
Error message
failed to run %#q on %#q: %#q: %w
What it means
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.
Source
Thrown at pkg/fsutil/fsutil_windows.go:38
// specific ssh toolchain should use WindowsSubsystemPathWithCygpath, which
// runs that toolchain's own cygpath and respects its fstab.
func WindowsSubsystemPath(ctx context.Context, orig string) (string, error) {
return WindowsSubsystemPathWithCygpath(ctx, "cygpath", orig)
}
// WindowsSubsystemPathWithCygpath converts a Windows path with the given
// cygpathExe ("cygpath" for PATH, or an absolute path to bind the conversion
// to one Cygwin install). When the cygpath binary is not found it falls back
// to a native conversion of the absolute drive-letter case; a cygpath that
// runs and fails returns its error, and non-drive-letter inputs (UNC, device,
// extended-length) return an error.
func WindowsSubsystemPathWithCygpath(ctx context.Context, cygpathExe, orig string) (string, error) {
out, err := exec.CommandContext(ctx, cygpathExe, filepath.ToSlash(orig)).CombinedOutput()
if err == nil {
return strings.TrimSpace(string(out)), nil
}
if !errors.Is(err, exec.ErrNotFound) && !errors.Is(err, fs.ErrNotExist) {
return "", fmt.Errorf("failed to run %#q on %#q: %#q: %w", cygpathExe, orig, strings.TrimSpace(string(out)), err)
}
logrus.WithError(err).Debugf("%#q not found for %#q, attempting native conversion", cygpathExe, orig)
return windowsSubsystemPathWithoutCygpath(orig)
}
func windowsSubsystemPathWithoutCygpath(orig string) (string, error) {
// The /c/... form this produces is the MSYS2 and Git-for-Windows
// convention; stock Cygwin defaults to /cygdrive/c/. Only an absolute
// drive-letter path ("C:\foo") has a well-defined form here. A
// drive-relative path ("C:foo") would become an unrelated absolute
// path, so reject it.
if !filepath.IsAbs(orig) {
return "", fmt.Errorf("cannot convert %#q to an MSYS-style path: input is not an absolute drive-letter path", orig)
}
// UNC path ("\\server\share\foo") is rejected here.View on GitHub (pinned to dd909d0973)
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.
Example fix
// before
p, err := fsutil.WindowsSubsystemPathWithCygpath(ctx, cygpathExe, orig)
// after
p, err := fsutil.WindowsSubsystemPathWithCygpath(ctx, `C:\Program Files\Git\usr\bin\cygpath.exe`, orig)
if err != nil {
log.WithError(err).Warn("cygpath failed; verify the installation")
} Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := exec.LookPath(cygpathExe); err != nil {
return fmt.Errorf("cygpath not available at %q", cygpathExe)
} Try / catch
p, err := fsutil.WindowsSubsystemPathWithCygpath(ctx, cygpathExe, orig)
if err != nil {
var ee *exec.ExitError
if errors.As(err, &ee) {
log.Errorf("cygpath failed: %v", ee.Stderr)
}
return fmt.Errorf("path conversion via cygpath failed: %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Users with partially uninstalled or multiple Cygwin/MSYS2/Git installations on Windows; PATH pointing at a stale cygpath.exe; antivirus blocking process spawn.
Related errors
- expected the depth of the converted host working directory (
- fsutil: Windows path conversion is not supported on this pla
- cannot convert %#q to an MSYS-style path: input is not an ab
- --condition=boot is only supported on macOS
- failed to register instance %#q to start at login: %w
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/3cca6774d21ddacd.
Report an issue: GitHub.