chenhg5/cc-connect · error
attachment too large: %d
Error message
attachment too large: %d
What it means
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.
Source
Thrown at platform/tuitui/tuitui.go:865
if rawURL == "" {
return nil, "", "", fmt.Errorf("empty URL")
}
dctx, cancel := context.WithTimeout(ctx, attachmentDownloadTO)
defer cancel()
req, err := http.NewRequestWithContext(dctx, http.MethodGet, rawURL, nil)
if err != nil {
return nil, "", "", err
}
resp, err := p.client.Do(req)
if err != nil {
return nil, "", "", errorsRedacted(err, p.appSecret)
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, "", "", fmt.Errorf("HTTP %d", resp.StatusCode)
}
if resp.ContentLength > maxAttachmentBytes {
return nil, "", "", fmt.Errorf("attachment too large: %d", resp.ContentLength)
}
buf, err := io.ReadAll(io.LimitReader(resp.Body, maxAttachmentBytes+1))
if err != nil {
return nil, "", "", err
}
if len(buf) > maxAttachmentBytes {
return nil, "", "", fmt.Errorf("attachment too large: %d", len(buf))
}
mimeType := resp.Header.Get("Content-Type")
if mimeType == "" || mimeType == "application/octet-stream" {
mimeType = http.DetectContentType(buf)
}
name := filenameFromResponse(rawURL, resp.Header.Get("Content-Disposition"))
return buf, mimeType, name, nil
}
func (p *Platform) DownloadHistoryFile(ctx context.Context, rawURL string) ([]byte, string, string, error) {
return p.downloadAttachment(ctx, rawURL)View on GitHub (pinned to 4000b2338a)
Solutions
- Ask users to send smaller attachments
- Raise maxAttachmentBytes if the deployment allows larger media
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at platform/tuitui/tuitui.go:865 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/357f7b1924b91ec8.
Report an issue: GitHub.