Tencent/WeKnora · error
read md file: %w
Error message
read md file: %w
What it means
The chosen .md entry inside the result ZIP could not be read/decompressed by readZipEntry. The archive lists the Markdown file but extracting its bytes failed (corrupt deflate stream, CRC mismatch, entry truncated).
Source
Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:401
entries[f.Name] = f
if strings.HasSuffix(f.Name, ".md") {
mdFiles = append(mdFiles, f.Name)
}
}
if len(mdFiles) == 0 {
return "", nil, fmt.Errorf("no .md file found in zip")
}
sort.Slice(mdFiles, func(i, j int) bool {
di, dj := strings.Count(mdFiles[i], "/"), strings.Count(mdFiles[j], "/")
if di != dj {
return di < dj
}
return mdFiles[i] < mdFiles[j]
})
mdText, err := readZipEntry(entries[mdFiles[0]])
if err != nil {
return "", nil, fmt.Errorf("read md file: %w", err)
}
mdDir := filepath.Dir(mdFiles[0])
// Extract referenced images
var imageRefs []types.ImageRef
seen := map[string]bool{}
for _, match := range imgRefPattern.FindAllStringSubmatch(mdText, -1) {
imgPath := match[1]
if strings.HasPrefix(imgPath, "http://") || strings.HasPrefix(imgPath, "https://") || strings.HasPrefix(imgPath, "data:") {
continue
}
if seen[imgPath] {
continue
}
seen[imgPath] = true
resolved := resolveInZip(imgPath, mdDir, entries)View on GitHub (pinned to 988cbb0330)
Solutions
- Re-run the parse job — a corrupt archive is usually not recoverable client-side.
- Check MinerU's upload path for size limits or interrupted multipart uploads of the result ZIP.
- Retry downloadAndExtractZip first to rule out a download-side truncation that only surfaces here.
- If it recurs for specific documents, try parsing a smaller/simpler file to isolate size-related corruption.
Defensive patterns
Strategy: retry
Try / catch
md, _, err := conv.Read(ctx, req)
if err != nil && strings.Contains(err.Error(), "read md file") {
// corrupt archive member: one retry, then fail with the document id for reprocessing
md, _, err = conv.Read(ctx, req)
if err != nil {
return markDocumentForReprocess(req, err)
}
} Prevention
- Retry the parse job once before surfacing the failure
- Check storage upload paths for size limits and multipart completion
- Track which documents repeatedly produce corrupt archives
- Keep request timeouts generous so large ZIPs aren't truncated
When it happens
Trigger: readZipEntry(entries[mdFiles[0]]) returns an error when calling f.Open()/io.ReadAll on the selected .md member — typically a truncated or corrupt ZIP member.
Common situations: ZIP truncated during upload to result storage (upload interrupted, size limit hit); storage backend corruption; very large md entry hitting memory limits in readZipEntry's implementation.
Related errors
- open zip: %w
- no .md file found in zip
- write file content: %w
- read response body: %w
- failed to save file: %w
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/5e58ea43e83f9cf4.
Report an issue: GitHub.