{"record":{"id":"30af6a1a8583769e","repo":"Tencent/WeKnora","slug":"read-response-body-w-30af6a","errorCode":null,"errorMessage":"read response body: %w","messagePattern":"read response body: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/paddleocr_vl_converter.go","lineNumber":175,"sourceCode":"\t)\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"create request: %w\", err)\n\t}\n\thttpReq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tclient := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{\n\t\tTimeout:      paddleOCRVLTimeout,\n\t\tMaxRedirects: 5,\n\t})\n\tresp, err := client.Do(httpReq)\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"HTTP request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"read response body: %w\", err)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", nil, fmt.Errorf(\"PaddleOCR-VL API status %d: %s\", resp.StatusCode, string(respBody))\n\t}\n\n\tvar result paddleOCRVLResponse\n\tif err := json.Unmarshal(respBody, &result); err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"decode response: %w\", err)\n\t}\n\tif result.ErrorCode != 0 {\n\t\treturn \"\", nil, fmt.Errorf(\"PaddleOCR-VL error %d: %s\", result.ErrorCode, result.ErrorMsg)\n\t}\n\n\tpages := result.Result.LayoutParsingResults\n\tif len(pages) == 0 {\n\t\tlogger.Errorf(context.Background(), \"[PaddleOCR-VL] response has no layoutParsingResults\")\n\t\treturn \"\", nil, nil","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/paddleocr_vl_converter.go#L157-L193","documentation":"I/O error in PaddleOCRVLReader.callLayoutParsing: io.ReadAll of the response body failed even though the request completed. The %w carries the read error (truncated connection, reset); it fires before the status-code check can examine the response.","triggerScenarios":"Thrown at internal/infrastructure/docparser/paddleocr_vl_converter.go:175 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request; usually transient","Check network stability for large OCR responses","Increase timeout if truncation is systematic"],"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-08T15:18:49.778Z"}