Tencent/WeKnora · error
create request: %w
Error message
create request: %w
What it means
HTTP client error in PaddleOCRVLReader.callLayoutParsing: http.NewRequestWithContext could not build the POST to the local/self-hosted PaddleOCR-VL /layout-parsing endpoint. The %w retains the net/http cause; raised after payload marshaling, before the request is executed.
Source
Thrown at internal/infrastructure/docparser/paddleocr_vl_converter.go:159
func (c *PaddleOCRVLReader) callLayoutParsing(
ctx context.Context, req *types.ReadRequest, content []byte,
) (string, map[string]string, error) {
payload := paddleOCRVLRecognitionParams(c.useSeal, c.useChart)
payload["file"] = base64.StdEncoding.EncodeToString(content)
payload["fileType"] = fileTypeCode(req)
payload["visualize"] = false
body, err := json.Marshal(payload)
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)
}
View on GitHub (pinned to 988cbb0330)
Solutions
- Verify the configured PaddleOCR-VL endpoint parses as a URL
- Check for invalid characters introduced by config
- Log the composed URL to diagnose
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/infrastructure/docparser/paddleocr_vl_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/a6973a07df52cc9c.
Report an issue: GitHub.