Tencent/WeKnora · error

read jsonl body: %w

Error message

read jsonl body: %w

What it means

I/O error in PaddleOCRVLCloudReader.fetchResults: reading the response body of the JSONL download failed mid-stream. The %w wraps the io error; it fires after a 200 response was received, when the body itself cannot be fully read (connection reset, truncation).

Source

Thrown at internal/infrastructure/docparser/paddleocr_vl_cloud_converter.go:279

	} `json:"result"`
}

func (c *PaddleOCRVLCloudReader) fetchResults(jsonlURL string) (string, map[string]string, error) {
	if err := utils.ValidateURLForSSRF(jsonlURL); err != nil {
		return "", nil, fmt.Errorf("jsonl URL blocked by SSRF check: %v", err)
	}
	client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 120 * time.Second, MaxRedirects: 5})
	resp, err := client.Get(jsonlURL)
	if err != nil {
		return "", nil, fmt.Errorf("download jsonl: %w", err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return "", nil, fmt.Errorf("download jsonl status %d", resp.StatusCode)
	}
	data, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", nil, fmt.Errorf("read jsonl body: %w", err)
	}

	texts := make([]string, 0)
	images := make(map[string]string)
	for _, line := range strings.Split(strings.TrimSpace(string(data)), "\n") {
		line = strings.TrimSpace(line)
		if line == "" {
			continue
		}
		var parsed paddleOCRVLCloudResultLine
		if err := json.Unmarshal([]byte(line), &parsed); err != nil {
			logger.Errorf(context.Background(), "[PaddleOCR-VL Cloud] skip malformed jsonl line: %v", err)
			continue
		}
		for _, p := range parsed.Result.LayoutParsingResults {
			if t := strings.TrimSpace(p.Markdown.Text); t != "" {
				texts = append(texts, p.Markdown.Text)
			}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Retry the download; usually transient
  2. Check network stability for large result files
  3. Consider resumable/chunked download if it recurs
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/infrastructure/docparser/paddleocr_vl_cloud_converter.go:279 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/478a3da7062c56d2. Report an issue: GitHub.