{"record":{"id":"7a012f1866ff4780","repo":"chenhg5/cc-connect","slug":"s-cdn-http-d-s","errorCode":null,"errorMessage":"%s: CDN http %d: %s","messagePattern":"(.+?): CDN http (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weixin/cdn.go","lineNumber":146,"sourceCode":"\t}\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: new request: %w\", label, err)\n\t}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: get: %w\", label, err)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(io.LimitReader(resp.Body, maxWeixinMediaBytes+1))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: read: %w\", label, err)\n\t}\n\tif len(body) > maxWeixinMediaBytes {\n\t\treturn nil, fmt.Errorf(\"%s: CDN body exceeds %d bytes\", label, maxWeixinMediaBytes)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"%s: CDN http %d: %s\", label, resp.StatusCode, truncateForLog(body, 256))\n\t}\n\treturn body, nil\n}\n\nfunc downloadAndDecryptCDN(ctx context.Context, client *http.Client, cdnBase, encParam, aesKeyBase64, label string) ([]byte, error) {\n\tkey, err := parseAesKey(aesKeyBase64, label)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu := buildCdnDownloadURL(encParam, cdnBase)\n\tenc, err := fetchCdnBytes(ctx, client, u, label)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tplain, err := decryptAESECB(enc, key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: decrypt: %w\", label, err)\n\t}","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weixin/cdn.go#L128-L164","documentation":"The Weixin CDN returned a non-200 HTTP status for the media download in fetchCdnBytes (e.g. expired encrypted_query_param, wrong CDN region, or object removed). The truncated body logged in the message usually carries the server's error detail.","triggerScenarios":"Thrown at platform/weixin/cdn.go:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry after a short delay; expired CDN params sometimes recover on refresh","If 403/404 persists, re-request a fresh download param from Weixin or skip the media","Inspect the logged body snippet for the CDN's specific error code"],"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"}