wavetermdev/waveterm · error

file size (%d bytes) exceeds maximum of %d bytes

Error message

file size (%d bytes) exceeds maximum of %d bytes

What it means

checkFileSize enforces a per-command maximum (maxSize parameter) on source files for 'wsh file cp' and 'wsh file mv'; when info.Size exceeds it, the command fails with 'file size (%d bytes) exceeds maximum of %d bytes'. This protects the cp/mv transfer path from attempting to move files too large for the RPC-based transfer (distinct from the 10MB MaxFileSize used by write/append).

Source

Thrown at cmd/wsh/cmd/wshcmd-file.go:342

func checkFileSize(path string, maxSize int64) (*wshrpc.FileInfo, error) {
	fileData := wshrpc.FileData{
		Info: &wshrpc.FileInfo{
			Path: path}}

	info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
	err = convertNotFoundErr(err)
	if err != nil {
		return nil, fmt.Errorf("getting file info: %w", err)
	}
	if info.NotFound {
		return nil, fmt.Errorf("%s: no such file", path)
	}
	if info.IsDir {
		return nil, fmt.Errorf("%s: is a directory", path)
	}
	if info.Size > maxSize {
		return nil, fmt.Errorf("file size (%d bytes) exceeds maximum of %d bytes", info.Size, maxSize)
	}
	return info, nil
}

func fileCpRun(cmd *cobra.Command, args []string) error {
	src, dst := args[0], args[1]
	merge, err := cmd.Flags().GetBool("merge")
	if err != nil {
		return err
	}
	force, err := cmd.Flags().GetBool("force")
	if err != nil {
		return err
	}

	srcPath, err := fixRelativePaths(src)
	if err != nil {
		return fmt.Errorf("unable to parse src path: %w", err)

View on GitHub (pinned to a4447c1563)

Solutions

  1. Check the file size first ('wsh file info <src>') and pick a transfer method that supports it (scp/rsync, shared mount)
  2. Split the file into chunks under the cap, cp each, and reassemble remotely
  3. Compress the file to shrink it below the limit before copying

Example fix

// before
wsh file cp [block] big-video.mp4 @   # 2GB: exceeds maximum
// after
split -b 500m big-video.mp4 part_ && for f in part_*; do wsh file cp [block] "$f" @; done  # then reassemble remotely
Defensive patterns

Strategy: validation

Validate before calling

info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: fileTimeout})
if err == nil && info.Size > maxSize {
    return fmt.Errorf("%s is %d bytes; cap is %d — use scp/rsync or split the file", path, info.Size, maxSize)
}

Type guard

func withinSizeLimit(info *wshrpc.FileInfo, maxSize int64) bool {
    return info != nil && info.Size <= maxSize
}

Prevention

When it happens

Trigger: 'wsh file cp <src> <dst>' or 'wsh file mv <src> <dst>' where the remote source file's reported size (info.Size from FileInfoCommand) is greater than the maxSize passed by the calling command.

Common situations: Copying large datasets, videos, or build artifacts through wsh file cp; moving a file that grew since it was last handled; not knowing cp/mv impose their own size cap stricter/different from write's 10MB.

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


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/73a3d9195ab5b4f9. Report an issue: GitHub.