{"record":{"id":"01afbd23c2434bd2","repo":"Tencent/WeKnora","slug":"api-error-s","errorCode":null,"errorMessage":"API error: %s","messagePattern":"API error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/mineru_cloud_converter.go","lineNumber":156,"sourceCode":"\n\tclient := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 30 * time.Second, MaxRedirects: 5})\n\tresp, err := client.Do(httpReq)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"HTTP request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\trespBody, _ := io.ReadAll(resp.Body)\n\t\treturn \"\", \"\", fmt.Errorf(\"API status %d: %s\", resp.StatusCode, string(respBody))\n\t}\n\n\tvar result batchApplyResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"decode response: %w\", err)\n\t}\n\tif result.Code != 0 {\n\t\treturn \"\", \"\", fmt.Errorf(\"API error: %s\", result.Msg)\n\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 {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/mineru_cloud_converter.go#L138-L174","documentation":"Application-level error in MinerUCloudReader.applyUploadURLs: the response decoded successfully and HTTP was 200, but result.Code is non-zero — the MinerU API itself reported failure (e.g., invalid parameters, auth, quota) with result.Msg as the reason. Distinct from HTTP status and JSON decode errors in the same flow.","triggerScenarios":"Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:156 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read result.Msg for the API's stated reason","Check API key validity and account quota","Adjust the upload request per the reported message"],"exampleFix":null,"handlingStrategy":"validation","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"}