larksuite/cli · error

download exceeds size limit (max %s)

Error message

download exceeds size limit (max %s)

What it means

Returned from limitedReadCloser.Read when a download's accumulated bytes exceed maxSize; the reader aborts the transfer so oversized downloads fail fast. Classified by the download caller.

Source

Thrown at shortcuts/im/helpers.go:267

		closer: resp.Body,
		max:    maxSize,
	}
	return lr, ext, nil
}

// limitedReadCloser wraps a LimitReader and checks for size overflow on Close.
type limitedReadCloser struct {
	r      io.Reader
	closer io.Closer
	max    int64
	n      int64
}

func (l *limitedReadCloser) Read(p []byte) (int, error) {
	n, err := l.r.Read(p)
	l.n += int64(n)
	if l.n > l.max {
		return n, fmt.Errorf("download exceeds size limit (max %s)", common.FormatSize(l.max)) //nolint:forbidigo // io.Reader.Read contract returns a plain error; classified by the download caller
	}
	return n, err
}

func (l *limitedReadCloser) Close() error {
	return l.closer.Close()
}

// mediaKind distinguishes image uploads (image_key) from file uploads (file_key).
type mediaKind int

const (
	mediaKindImage mediaKind = iota // upload via image API, returns image_key
	mediaKindFile                   // upload via file API, returns file_key
)

// mediaSpec describes how to resolve and upload a single media input.
type mediaSpec struct {

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Exclude the oversized item or raise the download size limit
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/im/helpers.go:267 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/c5ba824c1c52f603. Report an issue: GitHub.