{"record":{"id":"729e7ac88e5d2cdc","repo":"chenhg5/cc-connect","slug":"download-w-729e7a","errorCode":null,"errorMessage":"download: %w","messagePattern":"download: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/wecom/wecom.go","lineNumber":890,"sourceCode":"\t}\n\tif len(data) >= 4 && string(data[:4]) == \"%PDF\" {\n\t\treturn \"application/pdf\"\n\t}\n\treturn \"\"\n}\n\nfunc (p *Platform) downloadMedia(mediaID string) ([]byte, error) {\n\taccessToken, err := p.getAccessToken()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get token: %w\", err)\n\t}\n\tu := p.wecomAPIURL(\"/cgi-bin/media/get\", url.Values{\n\t\t\"access_token\": []string{accessToken},\n\t\t\"media_id\":     []string{mediaID},\n\t})\n\tresp, err := p.apiClient.Get(u)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"download: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\treturn io.ReadAll(resp.Body)\n}\n","sourceCodeStart":872,"sourceCodeEnd":895,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/wecom/wecom.go#L872-L895","documentation":"Transport-level failure of GET /cgi-bin/media/get: the HTTP request to download a media file by media_id did not complete (connection error, reset, DNS or TLS failure, timeout). Note the body is read even on non-200 statuses; this wrap only covers the request/transport error itself.","triggerScenarios":"Thrown at platform/wecom/wecom.go:890 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the download with backoff — transient faults dominate","Check outbound connectivity to qyapi.weixin.qq.com","Verify the access_token/media_id are valid; expired tokens can yield unusable responses downstream","Consider a size limit when reading the body to avoid unbounded memory use"],"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"}