Tencent/WeKnora · error

HTTP request: %w

Error message

HTTP request: %w

What it means

Transport error in PaddleOCRVLReader.callLayoutParsing: the SSRF-safe HTTP client's Do() for the layout-parsing POST failed (service down, timeout, connection refused). The %w wraps the network cause; distinct from the status-code and decode errors handled after it in the same function.

Source

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

	if err != nil {
		return "", nil, fmt.Errorf("marshal payload: %w", err)
	}

	httpReq, err := http.NewRequestWithContext(
		ctx, http.MethodPost, c.endpoint+"/layout-parsing", bytes.NewReader(body),
	)
	if err != nil {
		return "", nil, fmt.Errorf("create request: %w", err)
	}
	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)

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check service reachability and load (large base64 bodies take time)
  2. Retry; adjust paddleOCRVLTimeout for big documents
  3. Verify SSRF-safe client configuration
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/infrastructure/docparser/paddleocr_vl_converter.go:169 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/52289b76643aef63. Report an issue: GitHub.