{"record":{"id":"56a4352079eb2c51","repo":"Tencent/WeKnora","slug":"paddleocr-vl-layout-parsing-w","errorCode":null,"errorMessage":"PaddleOCR-VL layout-parsing: %w","messagePattern":"PaddleOCR-VL layout-parsing: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/paddleocr_vl_converter.go","lineNumber":61,"sourceCode":"func (c *PaddleOCRVLReader) Read(ctx context.Context, req *types.ReadRequest) (*types.ReadResult, error) {\n\tif c.endpoint == \"\" {\n\t\treturn &types.ReadResult{Error: \"PaddleOCR-VL endpoint is not configured\"}, nil\n\t}\n\tif err := utils.ValidateURLForSSRF(c.endpoint); err != nil {\n\t\treturn &types.ReadResult{Error: fmt.Sprintf(\"PaddleOCR-VL endpoint blocked by SSRF policy: %v\", err)}, nil\n\t}\n\n\tcontent := req.FileContent\n\tif len(content) == 0 {\n\t\treturn &types.ReadResult{Error: \"no file content provided\"}, nil\n\t}\n\n\tlogger.Infof(context.Background(), \"[PaddleOCR-VL] Parsing file=%s size=%d via %s\",\n\t\treq.FileName, len(content), c.endpoint)\n\n\tmdContent, imagesB64, err := c.callLayoutParsing(ctx, req, content)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"PaddleOCR-VL layout-parsing: %w\", err)\n\t}\n\n\t// PaddleOCR-VL renders tables as styled HTML (per-cell text-align), which\n\t// wastes tokens and defeats the chunker's table-protection logic. Convert\n\t// them to Markdown tables (or strip layout attributes when conversion is\n\t// not possible) before downstream processing.\n\tmdContent = normalizeHTMLTables(mdContent)\n\n\timageRefs, mdContent := c.processImages(mdContent, imagesB64)\n\tmdContent, imageRefs = ensureOriginalImageRef(req, mdContent, imageRefs)\n\n\tlogger.Infof(context.Background(), \"[PaddleOCR-VL] Parsed successfully, markdown=%d chars, images=%d\",\n\t\tlen(mdContent), len(imageRefs))\n\n\treturn &types.ReadResult{\n\t\tMarkdownContent: mdContent,\n\t\tImageRefs:       imageRefs,\n\t}, nil","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/paddleocr_vl_converter.go#L43-L79","documentation":"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.","triggerScenarios":"Thrown at internal/infrastructure/docparser/paddleocr_vl_converter.go:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect ReadResult.Error for the underlying cause (config, SSRF, empty content, or API failure)","Fix the endpoint configuration or file content as indicated","Treat as a soft failure: the caller receives an error result, not a Go error"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}