{"record":{"id":"357f7b1924b91ec8","repo":"chenhg5/cc-connect","slug":"attachment-too-large-d","errorCode":null,"errorMessage":"attachment too large: %d","messagePattern":"attachment too large: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/tuitui/tuitui.go","lineNumber":865,"sourceCode":"\tif rawURL == \"\" {\n\t\treturn nil, \"\", \"\", fmt.Errorf(\"empty URL\")\n\t}\n\tdctx, cancel := context.WithTimeout(ctx, attachmentDownloadTO)\n\tdefer cancel()\n\treq, err := http.NewRequestWithContext(dctx, http.MethodGet, rawURL, nil)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", err\n\t}\n\tresp, err := p.client.Do(req)\n\tif err != nil {\n\t\treturn nil, \"\", \"\", errorsRedacted(err, p.appSecret)\n\t}\n\tdefer func() { _ = resp.Body.Close() }()\n\tif resp.StatusCode < 200 || resp.StatusCode >= 300 {\n\t\treturn nil, \"\", \"\", fmt.Errorf(\"HTTP %d\", resp.StatusCode)\n\t}\n\tif resp.ContentLength > maxAttachmentBytes {\n\t\treturn nil, \"\", \"\", fmt.Errorf(\"attachment too large: %d\", resp.ContentLength)\n\t}\n\tbuf, err := io.ReadAll(io.LimitReader(resp.Body, maxAttachmentBytes+1))\n\tif err != nil {\n\t\treturn nil, \"\", \"\", err\n\t}\n\tif len(buf) > maxAttachmentBytes {\n\t\treturn nil, \"\", \"\", fmt.Errorf(\"attachment too large: %d\", len(buf))\n\t}\n\tmimeType := resp.Header.Get(\"Content-Type\")\n\tif mimeType == \"\" || mimeType == \"application/octet-stream\" {\n\t\tmimeType = http.DetectContentType(buf)\n\t}\n\tname := filenameFromResponse(rawURL, resp.Header.Get(\"Content-Disposition\"))\n\treturn buf, mimeType, name, nil\n}\n\nfunc (p *Platform) DownloadHistoryFile(ctx context.Context, rawURL string) ([]byte, string, string, error) {\n\treturn p.downloadAttachment(ctx, rawURL)","sourceCodeStart":847,"sourceCodeEnd":883,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/tuitui/tuitui.go#L847-L883","documentation":"downloadAttachment rejected an attachment because Content-Length exceeds maxAttachmentBytes. Validation guard embedding the byte count; oversized attachments are skipped instead of being downloaded into memory.","triggerScenarios":"Thrown at platform/tuitui/tuitui.go:865 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ask users to send smaller attachments","Raise maxAttachmentBytes if the deployment allows larger media"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}