Tencent/WeKnora · error
MinerU file_parse: %w
Error message
MinerU file_parse: %w
What it means
Public entry point MinerUConverter.Read wraps every failure from callFileParse (the synchronous /file_parse API call) with this message. Any transport, request-construction, or response-decoding failure from the MinerU file parsing endpoint surfaces as 'MinerU file_parse: <cause>'. Inspect the wrapped cause to identify the real problem.
Source
Thrown at internal/infrastructure/docparser/mineru_converter.go:85
if err := validateMinerUOutboundURL(c.endpoint); err != nil {
return &types.ReadResult{Error: err.Error()}, nil
}
if c.vlmServerURL != "" {
if err := validateMinerUOutboundURL(c.vlmServerURL); err != nil {
return &types.ReadResult{Error: err.Error()}, nil
}
}
content := req.FileContent
if len(content) == 0 {
return &types.ReadResult{Error: "no file content provided"}, nil
}
logger.Infof(context.Background(), "[MinerU] Parsing file=%s size=%d via %s", req.FileName, len(content), c.endpoint)
mdContent, imagesB64, err := c.callFileParse(ctx, content, req.FileName, req.FileType)
if err != nil {
return nil, fmt.Errorf("MinerU file_parse: %w", err)
}
// MinerU already returns markdown with embedded HTML blocks (e.g. <table>, <details>).
// Re-running the whole document through html-to-markdown corrupts valid markdown
// by escaping headings and image syntax. Only apply narrow compatibility fixes.
mdContent = normalizeMinerUMarkdown(mdContent)
// Process images: decode base64, build ImageRef list, replace refs in markdown
imageRefs, mdContent := c.processImages(mdContent, imagesB64)
mdContent, imageRefs = ensureOriginalImageRef(req, mdContent, imageRefs)
logger.Infof(context.Background(), "[MinerU] Parsed successfully, markdown=%d chars, images=%d", len(mdContent), len(imageRefs))
return &types.ReadResult{
MarkdownContent: mdContent,
ImageRefs: imageRefs,
}, nilView on GitHub (pinned to 988cbb0330)
Solutions
- Unwrap the error (errors.Unwrap / %v of the cause) to see which inner step failed.
- Verify c.endpoint is correct and reachable (curl $ENDPOINT/file_parse/health if available).
- Check MinerU server logs for the corresponding request to see the server-side failure.
- Confirm the file content and FileType are valid for MinerU (supported formats: pdf, images, etc.).
Defensive patterns
Strategy: try-catch
Try / catch
doc, err := conv.Read(ctx, req)
if err != nil {
var transient bool
if strings.Contains(err.Error(), "HTTP request") || strings.Contains(err.Error(), "read zip body") {
transient = true // safe to retry
}
log.Printf("mineru parse failed (retryable=%v): %v", transient, err)
if transient {
doc, err = conv.Read(ctx, req)
}
} Prevention
- Always unwrap and classify the cause before deciding to retry
- Health-check the MinerU endpoint at service startup
- Wrap synchronous parse calls with a timeout budget and queue for async reprocessing
- Alert on spikes of this wrapper error
When it happens
Trigger: Any error returned by callFileParse(ctx, content, req.FileName, req.FileType): bad multipart construction, HTTP failure, non-200 status, or unparseable response body.
Common situations: MinerU endpoint unreachable or misconfigured (wrong c.endpoint base URL); server returned 4xx/5xx (see companion 'MinerU API status %d' error); response JSON shape changed between MinerU versions.
Related errors
- create request: %w
- HTTP request: %w
- MinerU API status %d: %s
- read response body: %w
- credential verification failed: %w
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/9568e13ca05ca979.
Report an issue: GitHub.