Tencent/WeKnora · error
extract zip: %w
Error message
extract zip: %w
What it means
The MinerU Cloud result ZIP (pointed to by full_zip_url) failed to download or unpack inside downloadAndExtractZip, and extractDoneResult wraps the failure as 'extract zip: %w' (mineru_cloud_converter.go:344). The wrapped cause may itself be the SSRF-check error, download error, status error, read error, or a zip extraction error. Only the result delivery step failed — parsing itself succeeded server-side.
Source
Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:344
return items, nil
}
// extractDoneResult extracts markdown and images from a completed batch item.
// Prefers inline markdown/content fields; falls back to downloading full_zip_url.
func (c *MinerUCloudReader) extractDoneResult(_ context.Context, item *extractResultItem) (string, []types.ImageRef, error) {
text := firstNonEmpty(item.Markdown, item.Content, item.Text)
if text != "" {
logger.Infof(context.Background(), "[MinerUCloud] parsed (inline), length=%d", len(text))
return text, nil, nil
}
if item.FullZipURL == "" {
return "", nil, fmt.Errorf("MinerU Cloud state=done but no markdown/content or full_zip_url")
}
md, imageRefs, err := downloadAndExtractZip(item.FullZipURL)
if err != nil {
return "", nil, fmt.Errorf("extract zip: %w", err)
}
logger.Infof(context.Background(), "[MinerUCloud] parsed (zip), markdown=%d chars, images=%d", len(md), len(imageRefs))
return md, imageRefs, nil
}
// --- ZIP handling ---
var imgRefPattern = regexp.MustCompile(`!\[[^\]]*\]\(([^)]+)\)`)
func downloadAndExtractZip(zipURL string) (string, []types.ImageRef, error) {
if err := utils.ValidateURLForSSRF(zipURL); err != nil {
return "", nil, fmt.Errorf("zip URL blocked by SSRF check: %v", err)
}
client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 120 * time.Second, MaxRedirects: 5})
resp, err := client.Get(zipURL)
if err != nil {
return "", nil, fmt.Errorf("download zip: %w", err)View on GitHub (pinned to 988cbb0330)
Solutions
- Unwrap the error to find which inner step failed (SSRF, download, status, read, or zip format) and address that specifically.
- Retry promptly after task completion if the URL may have expired; re-run the batch to get a fresh full_zip_url.
- Increase the 120s timeout or improve network access for very large ZIPs.
- Ensure the ZIP contains the expected markdown/content files; verify MinerU Cloud output layout.
Example fix
// before
md, imageRefs, err := downloadAndExtractZip(item.FullZipURL)
if err != nil {
return "", nil, fmt.Errorf("extract zip: %w", err)
}
// after — one bounded retry for transient failures
md, imageRefs, err := downloadAndExtractZip(item.FullZipURL)
if err != nil {
time.Sleep(2 * time.Second)
md, imageRefs, err = downloadAndExtractZip(item.FullZipURL)
if err != nil {
return "", nil, fmt.Errorf("extract zip: %w", err)
}
} Defensive patterns
Strategy: retry
Validate before calling
u, err := url.Parse(item.FullZipURL)
if err != nil || (u.Scheme != "http" && u.Scheme != "https") || u.Host == "" {
return errors.New("invalid full_zip_url")
} Try / catch
var md string
var images []types.ImageRef
var err error
for attempt := 0; attempt < 3; attempt++ {
md, images, err = pollBatchResult(ctx, batchID)
if err == nil || !strings.Contains(err.Error(), "extract zip:") {
break
}
time.Sleep(time.Duration(attempt+1) * 2 * time.Second)
}
if err != nil {
return err
} Prevention
- Unwrap the error to distinguish SSRF/download/status/read/zip-format causes before acting.
- Apply bounded retries for transient download failures.
- Size the HTTP timeout to your largest expected ZIP (the default is 120s).
When it happens
Trigger: extractDoneResult downloads item.FullZipURL and downloadAndExtractZip returns any error: SSRF validation rejection, HTTP GET failure, non-200 status, body read failure, or corrupt/unreadable ZIP content.
Common situations: Expired result download URLs (MinerU Cloud presigned links expire); large ZIPs exceeding the 120s client timeout on slow links; corporate proxies blocking the storage host; zip lacking the expected markdown file layout.
Related errors
- download zip: %w
- rerank call failed: %w
- failed to do bulk: %w
- failed to delete by query: %w
- failed to get file from KS3: %w
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/5527ab775022514a.
Report an issue: GitHub.