lima-vm/lima · error

fsutil: Windows path conversion is not supported on this pla

Error message

fsutil: Windows path conversion is not supported on this platform

What it means

On non-Windows builds, pkg/fsutil provides stubs for the Windows path-conversion API (WindowsSubsystemPath and friends) that return errWindowsPathConversionNotSupported. This error means a Windows-only API was invoked on a platform where it is not implemented. Per the source comment, correct callers only invoke these behind runtime.GOOS == "windows", so it is normally unreachable.

Source

Thrown at pkg/fsutil/fsutil_unix.go:17

//go:build !windows

// SPDX-FileCopyrightText: Copyright The Lima Authors
// SPDX-License-Identifier: Apache-2.0

package fsutil

import (
	"context"
	"errors"
)

// errWindowsPathConversionNotSupported is returned by the Windows path
// conversion stubs below. Callers only invoke them behind a
// runtime.GOOS == "windows" check, so this is never actually returned in
// practice; it exists so the fsutil_windows.go API still compiles here.
var errWindowsPathConversionNotSupported = errors.New("fsutil: Windows path conversion is not supported on this platform")

// WindowsSubsystemPath is the non-Windows stub for the Windows-only
// implementation in fsutil_windows.go.
func WindowsSubsystemPath(_ context.Context, _ string) (string, error) {
	return "", errWindowsPathConversionNotSupported
}

// WindowsSubsystemPathWithCygpath is the non-Windows stub for the
// Windows-only implementation in fsutil_windows.go.
func WindowsSubsystemPathWithCygpath(_ context.Context, _, _ string) (string, error) {
	return "", errWindowsPathConversionNotSupported
}

// WindowsSubsystemPathForLinux is the non-Windows stub for the Windows-only
// implementation in fsutil_windows.go.
func WindowsSubsystemPathForLinux(_ context.Context, _, _ string) (string, error) {
	return "", errWindowsPathConversionNotSupported
}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Add or restore a runtime.GOOS == "windows" guard before calling any WindowsSubsystemPath* function.
  2. Build split the caller into fsutil_windows.go / fsutil_unix.go variants like the library does.
  3. On non-Windows, use the native path directly instead of converting through cygpath/wslpath.
  4. Adjust tests to skip Windows path-conversion cases on non-Windows runners (t.Skip on GOOS).

Example fix

// before
p, err := fsutil.WindowsSubsystemPath(ctx, path)
// after
if runtime.GOOS != "windows" {
    return path // no conversion needed
}
p, err := fsutil.WindowsSubsystemPath(ctx, path)
Defensive patterns

Strategy: validation

Validate before calling

if runtime.GOOS != "windows" {
    // skip conversion; use the path as-is
    return orig
}

Type guard

func windowsPathConversionSupported() bool { return runtime.GOOS == "windows" }

Try / catch

p, err := fsutil.WindowsSubsystemPath(ctx, path)
if errors.Is(err, errWindowsPathConversionNotSupported) || runtime.GOOS != "windows" {
    p = path // no conversion needed off-Windows
}

Prevention

When it happens

Trigger: Calling WindowsSubsystemPath, WindowsSubsystemPathWithCygpath, or WindowsSubsystemPathForLinux from code compiled for/running on a non-Windows GOOS without the runtime.GOOS check.

Common situations: Porting Windows-specific code to Linux/macOS builds, unit tests running on non-Windows CI hitting these stubs, or missing GOOS guards after refactoring.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/6717303eb033a9d8. Report an issue: GitHub.