wavetermdev/waveterm · error
size must be greater than 0
Error message
size must be greater than 0
What it means
Returned by wsh debugterm when the requested terminal size is not greater than zero.
Source
Thrown at cmd/wsh/cmd/wshcmd-debugterm.go:92
}
if debugTermInput != "" {
fileData, err := os.ReadFile(debugTermInput)
if err != nil {
return fmt.Errorf("reading input file: %w", err)
}
termData, err := parseDebugTermStdinData(fileData)
if err != nil {
return err
}
if mode == DebugTermModeDecode {
WriteStdout("%s", formatDebugTermDecode(termData))
} else {
WriteStdout("%s", formatDebugTermHex(termData))
}
return nil
}
if debugTermSize <= 0 {
return fmt.Errorf("size must be greater than 0")
}
fullORef, err := resolveBlockArg()
if err != nil {
return err
}
rtn, err := wshclient.DebugTermCommand(RpcClient, wshrpc.CommandDebugTermData{
BlockId: fullORef.OID,
Size: debugTermSize,
}, &wshrpc.RpcOpts{Timeout: 2000})
if err != nil {
return fmt.Errorf("reading terminal output: %w", err)
}
termData, err := base64.StdEncoding.DecodeString(rtn.Data64)
if err != nil {
return fmt.Errorf("decoding terminal output: %w", err)
}
var output string
if mode == DebugTermModeDecode {View on GitHub (pinned to a4447c1563)
Solutions
- Pass a positive byte size, e.g. --size 4096
- Fix the script so a default > 0 is used when the variable is empty
- Remember size is bytes of terminal buffer output, not lines
Example fix
// before
SIZE=0; wsh debugterm --size "$SIZE"
// after
SIZE=${SIZE:-4096}; wsh debugterm --size "$SIZE" Defensive patterns
Strategy: validation
Validate before calling
if [ -z "$SIZE" ] || [ "$SIZE" -le 0 ] 2>/dev/null; then SIZE=4096 fi wsh debugterm --size "$SIZE" ...
Try / catch
size, err := strconv.Atoi(rawSize)
if err != nil || size <= 0 {
return fmt.Errorf("--size must be a positive integer (bytes), got %q", rawSize)
} Prevention
- Default the size in scripts when the variable may be empty (SIZE=${SIZE:-4096})
- Remember size is in bytes, not lines — never pass 0 expecting 'all'
- Validate numeric flags before invoking wsh
- Document expected ranges in wrapper scripts
When it happens
Trigger: Running `wsh debugterm` with --size 0, --size -1, or a value that parsed to <= 0 via the flag's Int/Int64 parsing.
Common situations: Passing --size=0 assuming it means 'everything'; script variable defaulting to 0 when unset; confusing size units (expecting lines instead of bytes) and passing 0.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- badge oref must be a block or tab (got %q)
- unknown --view %q; try one of: term, web, preview, edit, sys
- --workspace and --window are mutually exclusive; specify onl
- cannot parse connection name: %w
- --conn parameter is required
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/f105766ff9d003f7.
Report an issue: GitHub.