{"record":{"id":"1699b996a707b282","repo":"k3s-io/k3s","slug":"rootless-is-not-supported-on-windows","errorCode":null,"errorMessage":"Rootless is not supported on windows","messagePattern":"Rootless is not supported on windows","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/rootless/rootless_windows.go","lineNumber":4,"sourceCode":"package rootless\n\nfunc Rootless(stateDir string, enableIPv6 bool) error {\n\tpanic(\"Rootless is not supported on windows\")\n}\n","sourceCodeStart":1,"sourceCodeEnd":6,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/rootless/rootless_windows.go#L1-L6","documentation":"k3s rootless package (pkg/rootless/rootless_windows.go): the Windows build of k3s ships a stub Rootless() that panics immediately, because rootless mode (user-namespace, slirp/netavark networking) is implemented only for Linux. Seeing this panic means the Windows binary executed code that should only run on Linux builds.","triggerScenarios":"Compiling k3s for GOOS=windows and starting it with rootless enabled (the Rootless function invoked during startup); invoking pkg/rootless.Rootless from cross-platform tooling or tests that do not guard on runtime.GOOS.","commonSituations":"Experimental Windows k3s builds where a start path enables rootless; CI matrix builds running windows binaries against linux-only flags; code changes that call Rootless without a build-tag guard.","solutions":["Do not enable rootless mode on Windows: remove the --rootless flag / disable the rootless start path for windows builds","Guard the call site: only invoke Rootless when runtime.GOOS == 'linux' (or move it behind a linux build tag)","Run the rootless control plane on a Linux host or VM; Windows nodes should join an existing cluster as agents without rootless"],"exampleFix":"// before\nif err := rootless.Rootless(stateDir, enableIPv6); err != nil {\n    return err\n}\n\n// after\nif runtime.GOOS != \"linux\" {\n    return fmt.Errorf(\"rootless mode is only supported on linux, current GOOS: %s\", runtime.GOOS)\n}\nif err := rootless.Rootless(stateDir, enableIPv6); err != nil {\n    return err\n}","handlingStrategy":"validation","validationCode":"if runtime.GOOS != \"linux\" {\n    return fmt.Errorf(\"rootless mode requires linux; refusing on %s\", runtime.GOOS)\n}\nreturn rootless.Rootless(stateDir, enableIPv6)","typeGuard":"func supportsRootless() bool {\n    return runtime.GOOS == \"linux\"\n}","tryCatchPattern":null,"preventionTips":["Keep rootless strictly a linux code path: gate flag parsing as well as the call site by GOOS/build tags","Do not copy linux systemd units (k3s-rootless.service) to windows hosts","In cross-platform tooling and CI, assert GOOS before exercising pkg/rootless"],"tags":["rootless","windows","platform-unsupported","panic","k3s"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}