{"record":{"id":"7966fc0083d3d788","repo":"sipeed/picoclaw","slug":"download-media-returned-http-d","errorCode":null,"errorMessage":"download media returned HTTP %d","messagePattern":"download media returned HTTP (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/wecom/media.go","lineNumber":294,"sourceCode":"\tctx context.Context,\n\tscope, msgID, resourceURL, aesKey, fallbackExt string,\n) (string, error) {\n\tstore := c.GetMediaStore()\n\tif store == nil {\n\t\treturn \"\", fmt.Errorf(\"no media store available\")\n\t}\n\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, resourceURL, nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"create request: %w\", err)\n\t}\n\tresp, err := c.mediaClient.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"download media: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"download media returned HTTP %d\", resp.StatusCode)\n\t}\n\n\tdata, err := io.ReadAll(io.LimitReader(resp.Body, wecomOutboundMediaMaxBytes+1))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"read media: %w\", err)\n\t}\n\tif len(data) > wecomOutboundMediaMaxBytes {\n\t\treturn \"\", fmt.Errorf(\"media too large\")\n\t}\n\n\tif aesKey != \"\" {\n\t\tkey, keyErr := decodeMediaAESKey(aesKey)\n\t\tif keyErr != nil {\n\t\t\treturn \"\", keyErr\n\t\t}\n\t\tdata, err = decryptAESCBC(key, data)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"decrypt media: %w\", err)","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/wecom/media.go#L276-L312","documentation":"Error \"download media returned HTTP %d\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/wecom/media.go:294 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}