{"record":{"id":"2571cbb132bed9d4","repo":"chenhg5/cc-connect","slug":"s-new-request-w","errorCode":null,"errorMessage":"%s: new request: %w","messagePattern":"(.+?): new request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weixin/cdn.go","lineNumber":131,"sourceCode":"\treturn fmt.Sprintf(\"%s/download?encrypted_query_param=%s\",\n\t\tstrings.TrimRight(cdnBase, \"/\"),\n\t\turl.QueryEscape(encryptedQueryParam))\n}\n\nfunc buildCdnUploadURL(cdnBase, uploadParam, filekey string) string {\n\treturn fmt.Sprintf(\"%s/upload?encrypted_query_param=%s&filekey=%s\",\n\t\tstrings.TrimRight(cdnBase, \"/\"),\n\t\turl.QueryEscape(uploadParam),\n\t\turl.QueryEscape(filekey))\n}\n\nfunc fetchCdnBytes(ctx context.Context, client *http.Client, fullURL, label string) ([]byte, error) {\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\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}","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weixin/cdn.go#L113-L149","documentation":"http.NewRequestWithContext rejected the CDN download/upload URL while building the GET request in fetchCdnBytes — the assembled fullURL (from buildCdnDownloadURL/buildCdnUploadURL) is not parseable, indicating a malformed cdn_base or corrupted encrypted_query_param.","triggerScenarios":"Thrown at platform/weixin/cdn.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log fullURL (with the encrypted param redacted/truncated) to spot the malformed component","Check the cdn_base_url configuration and the CDN parameters received from Weixin for truncation or bad escaping"],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}