sqshq/sampler · error

PTY mode is not supported on Windows

Error message

PTY mode is not supported on Windows

What it means

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.

Source

Thrown at data/int_pty_windows.go:15

package data

import (
	"errors"
	"time"
)

type PtyInteractiveShell struct {
	item      *Item
	variables []string
	timeout   time.Duration
}

func (s *PtyInteractiveShell) init() error {
	return errors.New("PTY mode is not supported on Windows")
}

func (s *PtyInteractiveShell) execute() (string, error) {
	return "", errors.New("PTY mode is not supported on Windows")
}

View on GitHub (pinned to 9bc7ba732d)

Solutions

  1. Switch the item's interactive shell type from PTY to 'basic' on Windows
  2. Guard the PTY setup at startup: on runtime.GOOS == "windows" skip PTY items or fall back to basic shell
  3. Run the collector on Linux/macOS if PTY interaction is required
  4. Wrap init() and degrade gracefully: log the error and disable the item instead of failing the whole run

Example fix

// before
shell := item.NewPtyInteractiveShell(item, variables, timeout)
_ = shell.init()
// after
if runtime.GOOS == "windows" {
    shell = item.NewBasicInteractiveShell(item, variables, timeout)
} else {
    shell = item.NewPtyInteractiveShell(item, variables, timeout)
}
_ = shell.init()
Defensive patterns

Strategy: fallback

Validate before calling

if runtime.GOOS == "windows" { useBasicShell = true }

Type guard

func ptySupported() bool { return runtime.GOOS != "windows" }

Try / catch

if err := shell.init(); err != nil {
    log.Printf("PTY unavailable, falling back to basic shell: %v", err)
    shell = NewBasicInteractiveShell(item, vars, timeout)
}

Prevention

When it happens

Trigger: 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).

Common situations: Users porting a sampler/config from Linux or macOS to Windows while keeping interactive PTY mode enabled in the YAML.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of sqshq/sampler@9bc7ba732d (2026-09-06). Data as JSON: /api/errors/f0ba65cd2140b7f1. Report an issue: GitHub.