lima-vm/lima · error
cannot convert %#q to an MSYS-style path: input is not an ab
Error message
cannot convert %#q to an MSYS-style path: input is not an absolute drive-letter path
What it means
The native cygpath fallback only has a well-defined MSYS-style mapping for absolute drive-letter paths ("C:\foo" -> "/c/foo"). If the input path is not absolute (relative path or drive-relative like "C:foo"), conversion would silently produce an unrelated absolute path, so the function rejects it with this error.
Source
Thrown at pkg/fsutil/fsutil_windows.go:53
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.
if vol := filepath.VolumeName(orig); len(vol) == 2 && vol[1] == ':' {
// orig[2:] starts with a separator for an absolute drive path
// (C:\foo, C:/foo); strip it so the result stays canonical.
tail := strings.TrimPrefix(filepath.ToSlash(orig[2:]), "/")
converted := "/" + strings.ToLower(vol[:1]) + "/" + tail
logrus.Debugf("native cygpath fallback: %#q -> %#q", orig, converted)
return converted, nil
}
return "", fmt.Errorf("cannot convert %#q to an MSYS-style path: input is not an absolute drive-letter path", orig)
}
// WindowsSubsystemPathForLinux converts a Windows path to the WSL form of
// the given distro (e.g. C:\Users\jan -> /mnt/c/Users/jan) via wsl.exe.
func WindowsSubsystemPathForLinux(ctx context.Context, orig, distro string) (string, error) {View on GitHub (pinned to dd909d0973)
Solutions
- Convert the input to an absolute path before calling: filepath.Abs(orig) resolved against the intended working directory.
- Ensure the path starts with a drive letter followed by a separator (C:\...).
- Reject or prompt for absolute paths at the application's input boundary.
- Prefer installing cygpath (Git for Windows) so the primary conversion path handles more cases — though absoluteness is still required by the fallback.
Example fix
// before
p, err := fsutil.WindowsSubsystemPath(ctx, relPath)
// after
abs, err := filepath.Abs(relPath)
if err != nil { return err }
p, err := fsutil.WindowsSubsystemPath(ctx, abs) Defensive patterns
Strategy: validation
Validate before calling
abs, err := filepath.Abs(orig)
if err != nil { return err }
if vol := filepath.VolumeName(abs); len(vol) != 2 || vol[1] != ':' {
return fmt.Errorf("need an absolute drive-letter path, got %q", orig)
}
orig = abs Type guard
func isAbsoluteDriveLetterPath(p string) bool {
vol := filepath.VolumeName(p)
return len(vol) == 2 && vol[1] == ':' && len(p) > 2 && (p[2] == '\\' || p[2] == '/')
} Try / catch
p, err := fsutil.WindowsSubsystemPath(ctx, orig)
if err != nil && strings.Contains(err.Error(), "not an absolute drive-letter path") {
return fmt.Errorf("%q must be an absolute path like C:\\foo; resolve it against the working directory first", orig)
} Prevention
- Always filepath.Abs() user-supplied relative paths before conversion
- Reject drive-relative paths (C:foo) at input validation
- Document that the API requires fully-qualified Windows paths
When it happens
Trigger: Calling WindowsSubsystemPath (fallback path, i.e. cygpath.exe missing) with a relative path like "foo\bar", or a drive-relative path like "C:foo\bar" on Windows.
Common situations: Passing a path built from a relative working directory or user-supplied relative input; deriving paths from tools that return drive-relative results; misusing the API which expects fully-qualified Windows paths.
Related errors
- configuration is nil
- field `mountType` must be %#q for QEMU driver on Windows, go
- fsutil: Windows path conversion is not supported on this pla
- failed to run %#q on %#q: %#q: %w
- --condition=boot is only supported on macOS
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/90489de596886d02.
Report an issue: GitHub.