Tencent/WeKnora · error

PaddleOCR-VL API status %d: %s

Error message

PaddleOCR-VL API status %d: %s

What it means

Protocol error in PaddleOCRVLReader.callLayoutParsing: the layout-parsing endpoint answered with a non-200 status. The response body already read is embedded (%d status, %s body) to surface the OCR service's error detail; fires when the service is reachable but rejects the recognition request.

Source

Thrown at internal/infrastructure/docparser/paddleocr_vl_converter.go:179

	httpReq.Header.Set("Content-Type", "application/json")

	client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{
		Timeout:      paddleOCRVLTimeout,
		MaxRedirects: 5,
	})
	resp, err := client.Do(httpReq)
	if err != nil {
		return "", nil, fmt.Errorf("HTTP request: %w", err)
	}
	defer resp.Body.Close()

	respBody, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", nil, fmt.Errorf("read response body: %w", err)
	}

	if resp.StatusCode != http.StatusOK {
		return "", nil, fmt.Errorf("PaddleOCR-VL API status %d: %s", resp.StatusCode, string(respBody))
	}

	var result paddleOCRVLResponse
	if err := json.Unmarshal(respBody, &result); err != nil {
		return "", nil, fmt.Errorf("decode response: %w", err)
	}
	if result.ErrorCode != 0 {
		return "", nil, fmt.Errorf("PaddleOCR-VL error %d: %s", result.ErrorCode, result.ErrorMsg)
	}

	pages := result.Result.LayoutParsingResults
	if len(pages) == 0 {
		logger.Errorf(context.Background(), "[PaddleOCR-VL] response has no layoutParsingResults")
		return "", nil, nil
	}

	// Merge per-page markdown and image dicts into one document.
	texts := make([]string, 0, len(pages))

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Read the embedded body for the server's reason
  2. Verify file size/type constraints and auth
  3. Retry for 5xx; fix the request for 4xx
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/infrastructure/docparser/paddleocr_vl_converter.go:179 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/733b0c691809a13a. Report an issue: GitHub.