Tencent/WeKnora · error

API status

Error message

API status %d: %s

What it means

Protocol error in MinerUCloudReader.applyUploadURLs: the MinerU batch-apply endpoint returned a non-200 status. The response body is captured into the message (%d status, %s body) to expose the service's error text; it fires when the API is reachable but rejects the request (bad token, quota, malformed payload).

Solutions

  1. Check the embedded body for the API's error detail
  2. Verify the MinerU API key and quota
  3. Retry for 5xx; fix auth/request for 4xx
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:148 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/688a12ec4e58e2e6. Report an issue: GitHub.

Appendix: source

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

	}

	httpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, c.baseURL+"/file-urls/batch", bytes.NewReader(body))
	if err != nil {
		return "", "", fmt.Errorf("create request: %w", err)
	}
	httpReq.Header.Set("Authorization", "Bearer "+c.apiKey)
	httpReq.Header.Set("Content-Type", "application/json")

	client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 30 * time.Second, MaxRedirects: 5})
	resp, err := client.Do(httpReq)
	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 {

View on GitHub (pinned to 988cbb0330)