{"record":{"id":"ee131b22d9299287","repo":"larksuite/cli","slug":"attachment-count-d-exceeds-the-limit-of-d","errorCode":null,"errorMessage":"attachment count %d exceeds the limit of %d","messagePattern":"attachment count (.+?) exceeds the limit of (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/limits.go","lineNumber":58,"sourceCode":"\tvar existingBytes int64\n\tfor _, p := range flattenParts(snapshot.Body) {\n\t\tif p.IsMultipart() || !isAttachmentOrInline(p) {\n\t\t\tcontinue\n\t\t}\n\t\texistingCount++\n\t\texistingBytes += int64(len(p.Body))\n\t}\n\n\ttotalCount := existingCount\n\ttotalBytes := existingBytes + newFileSize\n\tif replacedPart != nil {\n\t\ttotalBytes -= int64(len(replacedPart.Body))\n\t} else {\n\t\ttotalCount++\n\t}\n\n\tif totalCount > maxAttachmentCount {\n\t\treturn fmt.Errorf(\"attachment count %d exceeds the limit of %d\", totalCount, maxAttachmentCount)\n\t}\n\tif totalBytes > maxAttachmentBytes {\n\t\treturn fmt.Errorf(\"total attachment size %.1f MB exceeds the 25 MB limit\",\n\t\t\tfloat64(totalBytes)/1024/1024)\n\t}\n\treturn nil\n}\n","sourceCodeStart":40,"sourceCodeEnd":66,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/limits.go#L40-L66","documentation":"Attachment-limit guard in checkSnapshotAttachmentLimit: adding the new attachment would push the draft past maxAttachmentCount (existing plus new parts).","triggerScenarios":"Thrown at shortcuts/mail/draft/limits.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove some attachments first, or split the mail into multiple messages"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}