wavetermdev/waveterm · error
input exceeds maximum file size of %d bytes
Error message
input exceeds maximum file size of %d bytes
What it means
streamWriteToFile enforces MaxFileSize as a hard cap on streamed input. When the cumulative bytes read exceed the limit, it aborts with "input exceeds maximum file size of %d bytes" rather than shipping an oversized file over RPC.
Source
Thrown at cmd/wsh/cmd/wshcmd-file-util.go:76
}
const chunkSize = wshrpc.FileChunkSize // 32KB chunks
buf := make([]byte, chunkSize)
totalWritten := int64(0)
for {
n, err := reader.Read(buf)
if err == io.EOF {
break
}
if err != nil {
return fmt.Errorf("reading input: %w", err)
}
// Check total size
totalWritten += int64(n)
if totalWritten > MaxFileSize {
return fmt.Errorf("input exceeds maximum file size of %d bytes", MaxFileSize)
}
// Prepare and send chunk
chunk := buf[:n]
appendData := fileData
appendData.Data64 = base64.StdEncoding.EncodeToString(chunk)
err = wshclient.FileAppendCommand(RpcClient, appendData, &wshrpc.RpcOpts{Timeout: int64(fileTimeout)})
if err != nil {
return fmt.Errorf("appending chunk to file: %w", err)
}
}
return nil
}
func streamReadFromFile(ctx context.Context, fileData wshrpc.FileData, writer io.Writer) error {
broker := RpcClient.StreamBrokerView on GitHub (pinned to a4447c1563)
Solutions
- Check MaxFileSize (in the wsh cmd package) and verify your input's size with `ls -l` or `du` before streaming.
- Split or compress the input so it fits under the limit, then transfer in parts.
- Use scp/rsync/ssh directly for files larger than the cap.
- If the limit is too small for your workflow, rebuild wsh with an adjusted MaxFileSize constant (at your own risk).
Example fix
// before cat 200GB.dump | wsh cp - remote:dump.bin // after split -b 90M 200GB.dump part_ && for f in part_*; do wsh cp "$f" "remote:dump_$f"; done
Defensive patterns
Strategy: validation
Validate before calling
fi, err := os.Stat(inputPath)
if err == nil && fi.Size() > MaxFileSize {
return fmt.Errorf("input %s is %d bytes, exceeds limit %d", inputPath, fi.Size(), MaxFileSize)
} Try / catch
if err := streamWriteToFile(fileData, reader); err != nil {
if strings.Contains(err.Error(), "maximum file size") {
// split/compress the input or use rsync/scp instead
}
} Prevention
- Check input size against MaxFileSize before streaming
- Split or compress oversized inputs
- Use scp/rsync for transfers beyond the cap
- Don't pipe unbounded streams (logs, yes) into wsh
When it happens
Trigger: Piping or copying input larger than MaxFileSize into `wsh` file streaming (e.g. `cat bigfile | wsh cp - remote:file`), where totalWritten > MaxFileSize after a chunk read.
Common situations: Redirecting huge log dumps, VM images, or datasets into wsh without checking size; underestimating binary sizes; accidentally piping an unbounded stream like `yes` or live logs.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- file %s exceeds maximum size of %s for %s files
- append would exceed maximum file size of %d bytes
- invalid rwnd size: %d
- request packets must have resid set
- msg.error
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/3a169400878ea019.
Report an issue: GitHub.