Tencent/WeKnora · error

decode response: %w

Error message

decode response: %w

What it means

Deserialization error in PaddleOCRVLCloudReader.submitJob: the response body could not be unmarshaled into paddleOCRVLCloudSubmitResponse. The %w wraps the JSON error, indicating the cloud OCR API returned an unexpected or malformed schema for the job submission reply.

Source

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

	}
	httpReq.Header.Set("Authorization", "bearer "+c.token)
	httpReq.Header.Set("Content-Type", writer.FormDataContentType())

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

	respBody, _ := io.ReadAll(resp.Body)
	if resp.StatusCode != http.StatusOK {
		return "", fmt.Errorf("API status %d: %s", resp.StatusCode, string(respBody))
	}

	var result paddleOCRVLCloudSubmitResponse
	if err := json.Unmarshal(respBody, &result); err != nil {
		return "", fmt.Errorf("decode response: %w", err)
	}
	if result.Data.JobID == "" {
		return "", fmt.Errorf("API returned no jobId: %s", string(respBody))
	}

	logger.Infof(context.Background(), "[PaddleOCR-VL Cloud] job submitted: jobId=%s", result.Data.JobID)
	return result.Data.JobID, nil
}

// --- polling ---

type paddleOCRVLCloudPollResponse struct {
	Data struct {
		State           string `json:"state"`
		ErrorMsg        string `json:"errorMsg"`
		ExtractProgress struct {
			TotalPages     int `json:"totalPages"`
			ExtractedPages int `json:"extractedPages"`

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Log a body snippet of the unexpected payload
  2. Check for proxies altering responses
  3. Verify the cloud API response schema version
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/infrastructure/docparser/paddleocr_vl_cloud_converter.go:159 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/52527658de906068. Report an issue: GitHub.