{"record":{"id":"8435ff2851412e8e","repo":"GoogleContainerTools/skaffold","slug":"unexpected-kind-of-os-process-probably-a-bug-s","errorCode":null,"errorMessage":"unexpected kind of os.Process. probably a bug: %s","messagePattern":"unexpected kind of os\\.Process\\. probably a bug: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubectl/exec_windows.go","lineNumber":93,"sourceCode":"\n\tc.handle = handle\n\tgo func() {\n\t\t<-c.ctx.Done()\n\t\tc.Terminate()\n\t}()\n\n\treturn nil\n}\n\nfunc getHandleFromProcess(p *os.Process) (windows.Handle, error) {\n\t// os.Process contains an unexported processHandle struct, which contains\n\t// a `handle uintptr` field.\n\tv := reflect.ValueOf(p)\n\ti := reflect.Indirect(v)\n\n\tk := i.Kind()\n\tif k != reflect.Struct {\n\t\treturn windows.InvalidHandle, fmt.Errorf(\"unexpected kind of os.Process. probably a bug: %s\", k)\n\t}\n\n\tf := i.FieldByName(\"handle\")\n\tif f.IsZero() {\n\t\treturn windows.InvalidHandle, fmt.Errorf(\"could not get 'handle' field from os.Process. probably a bug\")\n\t}\n\t// Get the processHandle struct\n\thandlestruct := reflect.Indirect(f)\n\thandle := handlestruct.FieldByName(\"handle\")\n\n\treturn windows.Handle(handle.Uint()), nil\n}\n\n// Run starts the specified command in a job object and waits for it to complete\nfunc (c *Cmd) Run() error {\n\tif err := c.Start(); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubectl/exec_windows.go#L75-L111","documentation":"getHandleFromProcess uses reflection to read the unexported 'handle' field of os.Process on Windows. Before touching the field it asserts that the dereferenced *os.Process is actually a struct; if the Go runtime ever changes that representation, this guard fires with the observed reflect.Kind. It is an internal invariant check, not a condition a user can normally cause.","triggerScenarios":"Calling Start (which calls getHandleFromProcess) on Windows with a Go standard library whose os.Process is no longer a plain struct under reflection — e.g. building with an unusual/patched Go toolchain, GOOS=windows build, or future stdlib refactor.","commonSituations":"Building Skaffold with a forked or very new/patched Go release where runtime internals changed; exotic cross-compilation setups; essentially never in normal use.","solutions":["Upgrade or pin to a Go toolchain version officially supported by this Skaffold release","Rebuild with the unmodified upstream Go toolchain (no -tags or stdlib overrides)","Report the Go version and reflect.Kind value to the Skaffold maintainers as a bug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Not user-validatable: depends on Go stdlib internals. Assert toolchain before build:\n// go version  # must match the version supported by the library release","typeGuard":null,"tryCatchPattern":"h, err := getHandleFromProcess(proc)\nif err != nil {\n    return fmt.Errorf(\"io redirection unsupported on this Go build: %w\", err)\n}","preventionTips":["Build with the Go toolchain version pinned by the project's CI/go.mod","Avoid patched/forked Go stdlib distributions for Windows builds","Add a CI smoke test on windows/amd64 that exercises Start with io redirection"],"tags":["windows","go","reflection","os-process"],"backgroundTag":"os-process-internals-changed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}