Tencent/WeKnora · error

API returned no file_urls

Error message

API returned no file_urls

What it means

Contract error in MinerUCloudReader.applyUploadURLs: the API call succeeded (Code==0) but the returned Data.FileURLs list is empty, leaving no presigned URL to upload the document to. It fires when MinerU grants a batch without a usable upload slot, aborting the upload before it starts.

Source

Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:159

	if err != nil {
		return "", "", fmt.Errorf("HTTP request: %w", err)
	}
	defer resp.Body.Close()

	if resp.StatusCode != http.StatusOK {
		respBody, _ := io.ReadAll(resp.Body)
		return "", "", fmt.Errorf("API status %d: %s", resp.StatusCode, string(respBody))
	}

	var result batchApplyResponse
	if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
		return "", "", fmt.Errorf("decode response: %w", err)
	}
	if result.Code != 0 {
		return "", "", fmt.Errorf("API error: %s", result.Msg)
	}
	if len(result.Data.FileURLs) == 0 {
		return "", "", fmt.Errorf("API returned no file_urls")
	}

	logger.Infof(context.Background(), "[MinerUCloud] batch apply ok: batch_id=%s, urls=%d", result.Data.BatchID, len(result.Data.FileURLs))
	return result.Data.BatchID, result.Data.FileURLs[0], nil
}

func (c *MinerUCloudReader) uploadFile(ctx context.Context, uploadURL string, content []byte) error {
	httpReq, err := http.NewRequestWithContext(ctx, http.MethodPut, uploadURL, bytes.NewReader(content))
	if err != nil {
		return fmt.Errorf("create PUT request: %w", err)
	}

	client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 120 * time.Second, MaxRedirects: 5})
	resp, err := client.Do(httpReq)
	if err != nil {
		return fmt.Errorf("PUT upload: %w", err)
	}
	resp.Body.Close()

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Retry the batch apply; may be a transient server anomaly
  2. Verify the request payload matches current API docs
  3. Contact MinerU support if it persists
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/infrastructure/docparser/mineru_cloud_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/a07d69bf93b5bd7b. Report an issue: GitHub.