Tencent/WeKnora · error

PaddleOCR-VL layout-parsing: %w

Error message

PaddleOCR-VL layout-parsing: %w

What it means

The layout-parsing call chain in PaddleOCRVLReader.Read failed (wrap point for callLayoutParsing errors). Unlike most paths, Read does not propagate the error — it converts it into ReadResult.Error so document parsing degrades gracefully instead of failing the request.

Source

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

func (c *PaddleOCRVLReader) Read(ctx context.Context, req *types.ReadRequest) (*types.ReadResult, error) {
	if c.endpoint == "" {
		return &types.ReadResult{Error: "PaddleOCR-VL endpoint is not configured"}, nil
	}
	if err := utils.ValidateURLForSSRF(c.endpoint); err != nil {
		return &types.ReadResult{Error: fmt.Sprintf("PaddleOCR-VL endpoint 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] Parsing file=%s size=%d via %s",
		req.FileName, len(content), c.endpoint)

	mdContent, imagesB64, err := c.callLayoutParsing(ctx, req, content)
	if err != nil {
		return nil, fmt.Errorf("PaddleOCR-VL layout-parsing: %w", err)
	}

	// PaddleOCR-VL renders tables as styled HTML (per-cell text-align), which
	// wastes tokens and defeats the chunker's table-protection logic. Convert
	// them to Markdown tables (or strip layout attributes when conversion is
	// not possible) before downstream processing.
	mdContent = normalizeHTMLTables(mdContent)

	imageRefs, mdContent := c.processImages(mdContent, imagesB64)
	mdContent, imageRefs = ensureOriginalImageRef(req, mdContent, imageRefs)

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

	return &types.ReadResult{
		MarkdownContent: mdContent,
		ImageRefs:       imageRefs,
	}, nil

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Inspect ReadResult.Error for the underlying cause (config, SSRF, empty content, or API failure)
  2. Fix the endpoint configuration or file content as indicated
  3. Treat as a soft failure: the caller receives an error result, not a Go error
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at internal/infrastructure/docparser/paddleocr_vl_converter.go:61 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/56a4352079eb2c51. Report an issue: GitHub.