{"record":{"id":"f105766ff9d003f7","repo":"wavetermdev/waveterm","slug":"size-must-be-greater-than-0","errorCode":null,"errorMessage":"size must be greater than 0","messagePattern":"size must be greater than 0","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-debugterm.go","lineNumber":92,"sourceCode":"\t}\n\tif debugTermInput != \"\" {\n\t\tfileData, err := os.ReadFile(debugTermInput)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"reading input file: %w\", err)\n\t\t}\n\t\ttermData, err := parseDebugTermStdinData(fileData)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif mode == DebugTermModeDecode {\n\t\t\tWriteStdout(\"%s\", formatDebugTermDecode(termData))\n\t\t} else {\n\t\t\tWriteStdout(\"%s\", formatDebugTermHex(termData))\n\t\t}\n\t\treturn nil\n\t}\n\tif debugTermSize <= 0 {\n\t\treturn fmt.Errorf(\"size must be greater than 0\")\n\t}\n\tfullORef, err := resolveBlockArg()\n\tif err != nil {\n\t\treturn err\n\t}\n\trtn, err := wshclient.DebugTermCommand(RpcClient, wshrpc.CommandDebugTermData{\n\t\tBlockId: fullORef.OID,\n\t\tSize:    debugTermSize,\n\t}, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reading terminal output: %w\", err)\n\t}\n\ttermData, err := base64.StdEncoding.DecodeString(rtn.Data64)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"decoding terminal output: %w\", err)\n\t}\n\tvar output string\n\tif mode == DebugTermModeDecode {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-debugterm.go#L74-L110","documentation":"Returned by wsh debugterm when the requested terminal size is not greater than zero.","triggerScenarios":"Running `wsh debugterm` with --size 0, --size -1, or a value that parsed to <= 0 via the flag's Int/Int64 parsing.","commonSituations":"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.","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"],"exampleFix":"// before\nSIZE=0; wsh debugterm --size \"$SIZE\"\n// after\nSIZE=${SIZE:-4096}; wsh debugterm --size \"$SIZE\"","handlingStrategy":"validation","validationCode":"if [ -z \"$SIZE\" ] || [ \"$SIZE\" -le 0 ] 2>/dev/null; then\n  SIZE=4096\nfi\nwsh debugterm --size \"$SIZE\" ...","typeGuard":null,"tryCatchPattern":"size, err := strconv.Atoi(rawSize)\nif err != nil || size <= 0 {\n\treturn fmt.Errorf(\"--size must be a positive integer (bytes), got %q\", rawSize)\n}","preventionTips":["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"],"tags":["validation","cli","arguments"],"backgroundTag":"invalid-argument-value","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}