sqshq/sampler · error
errorText.String()
Error message
errorText.String()
What it means
In the basic (non-PTY) interactive shell's execute loop, when the command's timeout fires while stderr output has been accumulated, the shell returns all collected stderr text as a Go error instead of the cleaned stdout. This means the error message you see is literally the command's own stderr, prefixed only by the call-site wrapper (if any). The library throws this so timeouts surface the program's own diagnostics rather than silently dropping them.
Source
Thrown at data/int_basic.go:120
var resultText strings.Builder
var errorText strings.Builder
for {
select {
case stdout := <-s.stdoutCh:
if len(stdout) > 0 {
resultText.WriteString(stdout)
resultText.WriteString("\n")
}
case stderr := <-s.stderrCh:
if len(stderr) > 0 {
errorText.WriteString(stderr)
errorText.WriteString("\n")
}
case <-timeout:
if errorText.Len() > 0 {
return "", errors.New(errorText.String())
}
return s.item.transform(vtclean.Clean(resultText.String(), false))
}
}
}
View on GitHub (pinned to 9bc7ba732d)
Solutions
- Increase the shell timeout (Item configuration) so the command finishes before the timer fires
- Fix the underlying command so it does not write to stderr or hang (check the stderr text in the error for the real cause)
- Reduce or eliminate stderr noise from the command (redirect benign warnings) if stderr presence plus slow run is expected
- Use PTY mode where supported for better interactive handling, or run the command outside the interactive shell with an explicit timeout wrapper
Example fix
// before item := item.NewItem(...) item.Interactive.Type = "basic" // after (give slow command more time) item.Interactive.Shell.Timeout = 60 * time.Second
Defensive patterns
Strategy: try-catch
Validate before calling
if cmd timeout risk: pre-estimate runtime, e.g. dry-run once with a generous timeout before enabling in config
Try / catch
out, err := shell.execute()
if err != nil {
log.Printf("command timed out or wrote to stderr: %v", err)
// fall back to last known good value or skip sample
return lastValue, nil
} Prevention
- Set realistic per-item timeouts based on measured command runtime
- Minimize stderr noise in invoked commands
- Alert on timeout errors so chronically slow commands are fixed
When it happens
Trigger: Running a command through a basic interactive shell whose runtime exceeds s.timeout while stderr bytes were already collected via errorText; the <-timeout case fires and returns errors.New(errorText.String()).
Common situations: Long-running commands (slow network installs, builds) under a tight per-item timeout config; commands that print warnings to stderr early then hang; Windows/macOS environments where the command blocks on a prompt.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- failed to execute command: %s
- PTY mode is not supported on Windows
- failed to execute command: %s
- panic(err)
- Failed to load the font:
AI-assisted analysis of sqshq/sampler@9bc7ba732d (2026-09-06).
Data as JSON: /api/errors/d6f6e527106dbd15.
Report an issue: GitHub.