{"record":{"id":"cd079731ea8e8a0c","repo":"chenhg5/cc-connect","slug":"http-d-cd0797","errorCode":null,"errorMessage":"HTTP %d","messagePattern":"HTTP %d","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/tuitui/tuitui.go","lineNumber":862,"sourceCode":"}\n\nfunc (p *Platform) downloadAttachment(ctx context.Context, rawURL string) ([]byte, string, string, error) {\n\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}","sourceCodeStart":844,"sourceCodeEnd":880,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/tuitui/tuitui.go#L844-L880","documentation":"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.","triggerScenarios":"Thrown at platform/tuitui/tuitui.go:862 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Signed URLs expire — re-fetch a fresh URL and retry","403/404: check media permissions or deletion"],"exampleFix":null,"handlingStrategy":"retry","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-14T05:17:10.506Z"}