{"record":{"id":"55574294c260c17f","repo":"Tencent/WeKnora","slug":"put-upload-w","errorCode":null,"errorMessage":"PUT upload: %w","messagePattern":"PUT upload: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/mineru_cloud_converter.go","lineNumber":175,"sourceCode":"\t}\n\tif len(result.Data.FileURLs) == 0 {\n\t\treturn \"\", \"\", fmt.Errorf(\"API returned no file_urls\")\n\t}\n\n\tlogger.Infof(context.Background(), \"[MinerUCloud] batch apply ok: batch_id=%s, urls=%d\", result.Data.BatchID, len(result.Data.FileURLs))\n\treturn result.Data.BatchID, result.Data.FileURLs[0], nil\n}\n\nfunc (c *MinerUCloudReader) uploadFile(ctx context.Context, uploadURL string, content []byte) error {\n\thttpReq, err := http.NewRequestWithContext(ctx, http.MethodPut, uploadURL, bytes.NewReader(content))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create PUT request: %w\", err)\n\t}\n\n\tclient := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 120 * time.Second, MaxRedirects: 5})\n\tresp, err := client.Do(httpReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"PUT upload: %w\", err)\n\t}\n\tresp.Body.Close()\n\n\tif resp.StatusCode >= 300 {\n\t\treturn fmt.Errorf(\"PUT upload status %d\", resp.StatusCode)\n\t}\n\tlogger.Infof(context.Background(), \"[MinerUCloud] file uploaded, status=%d\", resp.StatusCode)\n\treturn nil\n}\n\n// --- polling ---\n\ntype batchPollResponse struct {\n\tCode int    `json:\"code\"`\n\tMsg  string `json:\"msg\"`\n\tData struct {\n\t\tExtractResult json.RawMessage `json:\"extract_result\"` // can be object or array\n\t} `json:\"data\"`","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/mineru_cloud_converter.go#L157-L193","documentation":"Transport error in MinerUCloudReader.uploadFile: the SSRF-safe client's Do() for the PUT upload of the document bytes failed. The %w wraps the network/storage-side cause (timeout, connection reset); raised after the PUT request was built, before the response status check.","triggerScenarios":"Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:175 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the upload; large files on flaky networks are the usual cause","Check egress bandwidth and the 120s timeout adequacy","Re-apply for upload URLs if the pre-signed URL expired"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}