chenhg5/cc-connect · error

HTTP %d

Error message

HTTP %d

What it means

tuitui downloadAttachment: the attachment GET returned a non-2xx status; only the code is reported (no body) to avoid leaking details of the signed URL. Commonly an expired signed URL or removed media.

Source

Thrown at platform/tuitui/tuitui.go:862

}

func (p *Platform) downloadAttachment(ctx context.Context, rawURL string) ([]byte, string, string, error) {
	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
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Signed URLs expire — re-fetch a fresh URL and retry
  2. 403/404: check media permissions or deletion
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at platform/tuitui/tuitui.go:862 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/cd079731ea8e8a0c. Report an issue: GitHub.