Tencent/WeKnora · error

PaddleOCR-VL Cloud submit: %w

Error message

PaddleOCR-VL Cloud submit: %w

What it means

The PaddleOCR-VL Cloud converter's Read first submits the document to the cloud API via submitJob. Any failure during that submission (marshaling, building the multipart form, creating/sending the HTTP request, or a non-success HTTP response) is wrapped as 'PaddleOCR-VL Cloud submit'. The inner error tells you which submission step failed.

Source

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

func (c *PaddleOCRVLCloudReader) Read(ctx context.Context, req *types.ReadRequest) (*types.ReadResult, error) {
	if c.token == "" {
		return &types.ReadResult{Error: "PaddleOCR-VL Cloud token is not configured"}, nil
	}
	if err := utils.ValidateURLForSSRF(c.baseURL); err != nil {
		return &types.ReadResult{Error: fmt.Sprintf("PaddleOCR-VL Cloud base URL blocked by SSRF policy: %v", err)}, nil
	}

	content := req.FileContent
	if len(content) == 0 {
		return &types.ReadResult{Error: "no file content provided"}, nil
	}

	logger.Infof(context.Background(), "[PaddleOCR-VL Cloud] Parsing file=%s size=%d model=%s",
		req.FileName, len(content), c.model)

	jobID, err := c.submitJob(ctx, req, content)
	if err != nil {
		return nil, fmt.Errorf("PaddleOCR-VL Cloud submit: %w", err)
	}

	jsonlURL, err := c.pollJob(ctx, jobID)
	if err != nil {
		return nil, fmt.Errorf("PaddleOCR-VL Cloud poll: %w", err)
	}

	mdContent, imagesURL, err := c.fetchResults(jsonlURL)
	if err != nil {
		return nil, fmt.Errorf("PaddleOCR-VL Cloud fetch results: %w", err)
	}

	mdContent = normalizeHTMLTables(mdContent)

	imageRefs := c.downloadImages(mdContent, imagesURL)
	mdContent, imageRefs = ensureOriginalImageRef(req, mdContent, imageRefs)

	logger.Infof(context.Background(), "[PaddleOCR-VL Cloud] Parsed successfully, markdown=%d chars, images=%d",

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Inspect the wrapped cause (%w) — it identifies the exact failing step
  2. Verify the PaddleOCR-VL base URL and bearer token configuration
  3. Test cloud reachability from the deployment (egress/proxy rules)
  4. Confirm the file is a supported type/size for the cloud API
  5. Retry on transient 5xx/timeouts with backoff

Example fix

// before
client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 60 * time.Second})
// after (bigger uploads need more time)
client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 300 * time.Second, MaxRedirects: 5})
Defensive patterns

Strategy: try-catch

Validate before calling

if c.baseURL == "" || !strings.HasPrefix(c.baseURL, "https://") {
    return errors.New("PaddleOCR-VL base URL must be set to an https endpoint")
}
if c.token == "" {
    return errors.New("PaddleOCR-VL token is required")
}

Type guard

func isSubmitFailure(err error) bool {
    return err != nil && strings.Contains(err.Error(), "PaddleOCR-VL Cloud submit")
}

Try / catch

out, err := reader.Read(ctx, req)
if isSubmitFailure(err) {
    if isTransient(err) { out, err = retryWithBackoff(3, reader.Read, ctx, req) }
    if err != nil { return fmt.Errorf("document submit failed: %w", err) }
}

Prevention

When it happens

Trigger: Read -> submitJob fails: optionalPayload marshal error, CreateFormFile error, write-file error, http.NewRequestWithContext error, client.Do transport error, or the cloud API returning a non-OK status for the job submission.

Common situations: Expired or invalid PaddleOCR-VL cloud token (401); wrong c.baseURL env config; network egress blocked; oversized upload rejected by the cloud endpoint; malformed model/optional payload rejected with 400.

Related errors


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