{"record":{"id":"f0ba65cd2140b7f1","repo":"sqshq/sampler","slug":"pty-mode-is-not-supported-on-windows","errorCode":null,"errorMessage":"PTY mode is not supported on Windows","messagePattern":"PTY mode is not supported on Windows","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"data/int_pty_windows.go","lineNumber":15,"sourceCode":"package data\n\nimport (\n\t\"errors\"\n\t\"time\"\n)\n\ntype PtyInteractiveShell struct {\n\titem      *Item\n\tvariables []string\n\ttimeout   time.Duration\n}\n\nfunc (s *PtyInteractiveShell) init() error {\n\treturn errors.New(\"PTY mode is not supported on Windows\")\n}\n\nfunc (s *PtyInteractiveShell) execute() (string, error) {\n\treturn \"\", errors.New(\"PTY mode is not supported on Windows\")\n}\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/sqshq/sampler/blob/9bc7ba732d31f32a917ad4b5605f00b76ebe0891/data/int_pty_windows.go#L1-L21","documentation":"PtyInteractiveShell.init on Windows is a stub that always returns an error because PTY (pseudo-terminal) sessions are not implemented for the Windows build of this library. Any attempt to set up a PTY interactive shell on Windows fails immediately at initialization time. This is a deliberate platform capability limit, not a user configuration mistake in the shell itself.","triggerScenarios":"Configuring an item with interactive PTY shell mode (item.ptyShell = NewPtyInteractiveShell / interactive type 'pty') and calling init() on a Windows build (int_pty_windows.go).","commonSituations":"Users porting a sampler/config from Linux or macOS to Windows while keeping interactive PTY mode enabled in the YAML.","solutions":["Switch the item's interactive shell type from PTY to 'basic' on Windows","Guard the PTY setup at startup: on runtime.GOOS == \"windows\" skip PTY items or fall back to basic shell","Run the collector on Linux/macOS if PTY interaction is required","Wrap init() and degrade gracefully: log the error and disable the item instead of failing the whole run"],"exampleFix":"// before\nshell := item.NewPtyInteractiveShell(item, variables, timeout)\n_ = shell.init()\n// after\nif runtime.GOOS == \"windows\" {\n    shell = item.NewBasicInteractiveShell(item, variables, timeout)\n} else {\n    shell = item.NewPtyInteractiveShell(item, variables, timeout)\n}\n_ = shell.init()","handlingStrategy":"fallback","validationCode":"if runtime.GOOS == \"windows\" { useBasicShell = true }","typeGuard":"func ptySupported() bool { return runtime.GOOS != \"windows\" }","tryCatchPattern":"if err := shell.init(); err != nil {\n    log.Printf(\"PTY unavailable, falling back to basic shell: %v\", err)\n    shell = NewBasicInteractiveShell(item, vars, timeout)\n}","preventionTips":["Gate PTY features on GOOS at startup","Document Windows limitations for config authors","Test configs on target OS before deployment"],"tags":["go","windows","pty","unsupported-platform"],"backgroundTag":"unsupported-platform","analyzedSha":"9bc7ba732d31f32a917ad4b5605f00b76ebe0891","analyzedAt":"2026-09-06T08:38:02.595Z","contentChangedAt":"2026-09-06T08:38:02.595Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}