wavetermdev/waveterm · error
file already at maximum size (%d bytes)
Error message
file already at maximum size (%d bytes)
What it means
wsh file append refuses to start when the remote file already has size >= MaxFileSize (10MB). The append command enforces the same hard cap as file write, so once a file reaches the cap no more data may be appended. The check uses FileInfo returned by ensureFile before any data is read from stdin.
Source
Thrown at cmd/wsh/cmd/wshcmd-file.go:281
return nil
}
func fileAppendRun(cmd *cobra.Command, args []string) error {
path, err := fixRelativePaths(args[0])
if err != nil {
return err
}
fileData := wshrpc.FileData{
Info: &wshrpc.FileInfo{
Path: path}}
info, err := ensureFile(fileData)
if err != nil {
return err
}
if info.Size >= MaxFileSize {
return fmt.Errorf("file already at maximum size (%d bytes)", MaxFileSize)
}
reader := bufio.NewReader(WrappedStdin)
var buf bytes.Buffer
remainingSpace := MaxFileSize - info.Size
for {
chunk := make([]byte, 8192)
n, err := reader.Read(chunk)
if err == io.EOF {
break
}
if err != nil {
return fmt.Errorf("reading input: %w", err)
}
if int64(buf.Len()+n) > remainingSpace {
return fmt.Errorf("append would exceed maximum file size of %d bytes", MaxFileSize)
}View on GitHub (pinned to a4447c1563)
Solutions
- Stop appending and rotate the file: write to a new file name instead
- Truncate or remove the remote file if the old content is no longer needed ('wsh file write' with empty input or rm)
- Split the data across multiple files under 10MB each
Example fix
// before wsh file append [block] app.log < stream.log # fails: file already at maximum size // after wsh file write [block] app-2026-09.log < stream.log # rotate to a new file
Defensive patterns
Strategy: validation
Validate before calling
info, err := wshclient.FileInfoCommand(RpcClient, wshrpc.CommandFileData{Info: &wshrpc.FileInfo{Path: path}}, &wshrpc.RpcOpts{Timeout: fileTimeout})
if err == nil && info.Size >= 10*1024*1024 {
return fmt.Errorf("cannot append: %s already at %d bytes", path, info.Size)
} Type guard
func fileAtCap(info *wshrpc.FileInfo) bool {
return info != nil && info.Size >= 10*1024*1024
} Prevention
- Check remote file size before long-running append jobs
- Rotate log/data files before they reach 10MB
- Monitor append targets with periodic 'wsh file info' calls
When it happens
Trigger: Running 'wsh file append [block] <path>' when ensureFile reports info.Size >= 10485760 bytes for the target file.
Common situations: Repeatedly appending log output to the same remote file until it hits the 10MB cap; piping an ongoing stream into an already-full file.
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
- append would exceed maximum file size of %d bytes
- file %s exceeds maximum size of %s for %s files
- file size (%d bytes) exceeds maximum of %d bytes
- Image too large (>5MB)
- input exceeds maximum file size of %d bytes
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/23e2d912ba1ec76b.
Report an issue: GitHub.