lima-vm/lima · error
unimplemented
Error message
unimplemented
What it means
The Windows build of osutil provides a Dup2 stub that always returns this 'unimplemented' error, because Windows has no file-descriptor duplication syscall equivalent exposed through syscall.Dup2. The function exists only to satisfy the cross-platform API surface.
Source
Thrown at pkg/osutil/osutil_windows.go:61
}
// ProcessAlive reports whether the process with the given PID is still running.
func ProcessAlive(pid int) bool {
h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
if err != nil {
return false
}
var exitCode uint32
err = windows.GetExitCodeProcess(h, &exitCode)
_ = windows.CloseHandle(h)
if err != nil {
return false
}
return exitCode == 259 // STILL_ACTIVE
}
func Dup2(_ int, _ syscall.Handle) error {
return errors.New("unimplemented")
}
func SignalName(sig os.Signal) string {
switch sig {
case syscall.SIGINT:
return "SIGINT"
case syscall.SIGTERM:
return "SIGTERM"
default:
return fmt.Sprintf("Signal(%d)", sig)
}
}
func Sysctl(_ context.Context, _ string) (string, error) {
return "", errors.New("sysctl: unimplemented on Windows")
}
func IsEACCES(err error) bool {View on GitHub (pinned to dd909d0973)
Solutions
- Do not call Dup2 on Windows; gate the call behind runtime.GOOS checks or build tags.
- Use Windows-appropriate redirection instead (SetStdHandle / os.Process attributes like Stderr in os/exec).
- If redirecting logs, reopen the log file and reassign os.Stderr via a Windows-supported mechanism.
Example fix
// before
osutil.Dup2(int(f.Fd()))
// after
if runtime.GOOS != "windows" {
_ = osutil.Dup2(int(f.Fd()))
} else {
// use SetStdHandle or exec.Cmd Stderr wiring
} Defensive patterns
Strategy: type-guard
Validate before calling
if runtime.GOOS == "windows" {
// Dup2 is unimplemented; use exec.Cmd Stderr or SetStdHandle instead
} Type guard
func dup2Supported() bool { return runtime.GOOS != "windows" } Try / catch
if err := osutil.Dup2(fd); err != nil {
if err.Error() == "unimplemented" && runtime.GOOS == "windows" {
return redirectToStdHandle(fd) // windows-specific path
}
return err
} Prevention
- Never call Dup2 in code paths compiled for windows (use build tags)
- Use os/exec Cmd.Std* wiring for fd redirection instead of Dup2
- Add a unit test asserting no Dup2 call sites execute on windows
When it happens
Trigger: Any caller invoking osutil.Dup2 on a Windows build — there is no code path that succeeds; every call returns errors.New("unimplemented").
Common situations: Code shared across platforms calling Dup2 (e.g. to redirect stderr to a log file, typical in daemon/log-rotation code) being compiled and run on Windows; cross-compiling Unix daemon logic to Windows.
Related errors
- sysctl: unimplemented on Windows
- unimplemented
- unimplemented
- --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/f86d9536a10c21e4.
Report an issue: GitHub.