{"record":{"id":"6717303eb033a9d8","repo":"lima-vm/lima","slug":"fsutil-windows-path-conversion-is-not-supported-o","errorCode":null,"errorMessage":"fsutil: Windows path conversion is not supported on this platform","messagePattern":"fsutil: Windows path conversion is not supported on this platform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/fsutil/fsutil_unix.go","lineNumber":17,"sourceCode":"//go:build !windows\n\n// SPDX-FileCopyrightText: Copyright The Lima Authors\n// SPDX-License-Identifier: Apache-2.0\n\npackage fsutil\n\nimport (\n\t\"context\"\n\t\"errors\"\n)\n\n// errWindowsPathConversionNotSupported is returned by the Windows path\n// conversion stubs below. Callers only invoke them behind a\n// runtime.GOOS == \"windows\" check, so this is never actually returned in\n// practice; it exists so the fsutil_windows.go API still compiles here.\nvar errWindowsPathConversionNotSupported = errors.New(\"fsutil: Windows path conversion is not supported on this platform\")\n\n// WindowsSubsystemPath is the non-Windows stub for the Windows-only\n// implementation in fsutil_windows.go.\nfunc WindowsSubsystemPath(_ context.Context, _ string) (string, error) {\n\treturn \"\", errWindowsPathConversionNotSupported\n}\n\n// WindowsSubsystemPathWithCygpath is the non-Windows stub for the\n// Windows-only implementation in fsutil_windows.go.\nfunc WindowsSubsystemPathWithCygpath(_ context.Context, _, _ string) (string, error) {\n\treturn \"\", errWindowsPathConversionNotSupported\n}\n\n// WindowsSubsystemPathForLinux is the non-Windows stub for the Windows-only\n// implementation in fsutil_windows.go.\nfunc WindowsSubsystemPathForLinux(_ context.Context, _, _ string) (string, error) {\n\treturn \"\", errWindowsPathConversionNotSupported\n}","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/fsutil/fsutil_unix.go#L1-L35","documentation":"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.","triggerScenarios":"Calling WindowsSubsystemPath, WindowsSubsystemPathWithCygpath, or WindowsSubsystemPathForLinux from code compiled for/running on a non-Windows GOOS without the runtime.GOOS check.","commonSituations":"Porting Windows-specific code to Linux/macOS builds, unit tests running on non-Windows CI hitting these stubs, or missing GOOS guards after refactoring.","solutions":["Add or restore a runtime.GOOS == \"windows\" guard before calling any WindowsSubsystemPath* function.","Build split the caller into fsutil_windows.go / fsutil_unix.go variants like the library does.","On non-Windows, use the native path directly instead of converting through cygpath/wslpath.","Adjust tests to skip Windows path-conversion cases on non-Windows runners (t.Skip on GOOS)."],"exampleFix":"// before\np, err := fsutil.WindowsSubsystemPath(ctx, path)\n// after\nif runtime.GOOS != \"windows\" {\n    return path // no conversion needed\n}\np, err := fsutil.WindowsSubsystemPath(ctx, path)","handlingStrategy":"validation","validationCode":"if runtime.GOOS != \"windows\" {\n    // skip conversion; use the path as-is\n    return orig\n}","typeGuard":"func windowsPathConversionSupported() bool { return runtime.GOOS == \"windows\" }","tryCatchPattern":"p, err := fsutil.WindowsSubsystemPath(ctx, path)\nif errors.Is(err, errWindowsPathConversionNotSupported) || runtime.GOOS != \"windows\" {\n    p = path // no conversion needed off-Windows\n}","preventionTips":["Never call WindowsSubsystemPath* without a GOOS guard","Mirror the library's _windows/_unix file-split pattern","Skip Windows-only conversion tests on non-Windows CI"],"tags":["fsutil","windows","platform-support"],"backgroundTag":"not-implemented-for-platform","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}