{"record":{"id":"e1b1590fab05922a","repo":"k3s-io/k3s","slug":"rootless-is-not-supported-on-windows-e1b159","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/rootlessports/controller_windows.go","lineNumber":10,"sourceCode":"package rootlessports\n\nimport (\n\t\"context\"\n\n\tcorev1 \"github.com/rancher/wrangler/v3/pkg/generated/controllers/core/v1\"\n)\n\nfunc Register(ctx context.Context, serviceController corev1.ServiceController, enabled bool, httpsPort int) error {\n\tpanic(\"Rootless is not supported on windows\")\n}\n","sourceCodeStart":1,"sourceCodeEnd":12,"githubUrl":"https://github.com/k3s-io/k3s/blob/6ba341e396edc16b8dcae978a7c5e3ac7ee5606e/pkg/rootlessports/controller_windows.go#L1-L12","documentation":"k3s rootlessports package (pkg/rootlessports/controller_windows.go): on Windows builds Register() is a stub that panics, because the rootless port-forwarding controller (service LB via rootlesskit) only exists for Linux. The panic indicates the agent's controller-registration path executed the Windows stub.","triggerScenarios":"Windows k3s build reaching agent controller registration with rootless ports enabled (rootless mode or the service load balancer path that calls rootlessports.Register); calling Register unconditionally from cross-platform code.","commonSituations":"Running experimental windows binaries with rootless/service-LB settings carried over from linux configs; refactors that register rootless ports without a GOOS guard; CI running windows binaries through linux-oriented startup steps.","solutions":["Disable rootless port forwarding on Windows nodes: drop the rootless/rootless-ports related flags from the windows k3s invocation","Guard the registration call: skip rootlessports.Register when runtime.GOOS != 'linux'","Use a Linux node (or WSL2 VM) when rootless service load balancing is required"],"exampleFix":"// before\nif err := rootlessports.Register(ctx, serviceController, enabled, httpsPort); err != nil {\n    return err\n}\n\n// after\nif runtime.GOOS == \"linux\" {\n    if err := rootlessports.Register(ctx, serviceController, enabled, httpsPort); err != nil {\n        return err\n    }\n}","handlingStrategy":"validation","validationCode":"if runtime.GOOS == \"linux\" {\n    if err := rootlessports.Register(ctx, serviceController, enabled, httpsPort); err != nil {\n        return err\n    }\n}","typeGuard":"func supportsRootlessPorts() bool {\n    return runtime.GOOS == \"linux\"\n}","tryCatchPattern":null,"preventionTips":["Register rootless ports only on linux nodes; windows agents must skip this controller","Keep windows k3s configuration free of rootless/service-LB rootless settings copied from linux configs","Add GOOS assertions in unit tests that call rootlessports.Register so windows CI fails loudly at test time, not at runtime"],"tags":["rootless","windows","port-forwarding","platform-unsupported","panic","k3s"],"backgroundTag":null,"analyzedSha":"6ba341e396edc16b8dcae978a7c5e3ac7ee5606e","analyzedAt":"2026-08-15T16:27:54.286Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}