larksuite/cli · error

total attachment size %.1f MB exceeds the 25 MB limit

Error message

total attachment size %.1f MB exceeds the 25 MB limit

What it means

Attachment-limit guard in checkSnapshotAttachmentLimit: total attachment bytes (existing plus new, minus replaced part) exceed the 25 MB mail draft cap.

Source

Thrown at shortcuts/mail/draft/limits.go:61

			continue
		}
		existingCount++
		existingBytes += int64(len(p.Body))
	}

	totalCount := existingCount
	totalBytes := existingBytes + newFileSize
	if replacedPart != nil {
		totalBytes -= int64(len(replacedPart.Body))
	} else {
		totalCount++
	}

	if totalCount > maxAttachmentCount {
		return fmt.Errorf("attachment count %d exceeds the limit of %d", totalCount, maxAttachmentCount)
	}
	if totalBytes > maxAttachmentBytes {
		return fmt.Errorf("total attachment size %.1f MB exceeds the 25 MB limit",
			float64(totalBytes)/1024/1024)
	}
	return nil
}

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Use the large-attachment upload path instead of inline MIME parts, or attach less data
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at shortcuts/mail/draft/limits.go:61 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/7a717747dd338aea. Report an issue: GitHub.