Tencent/WeKnora · error
API error
Error message
API error: %s
What it means
Application-level error in MinerUCloudReader.applyUploadURLs: the response decoded successfully and HTTP was 200, but result.Code is non-zero — the MinerU API itself reported failure (e.g., invalid parameters, auth, quota) with result.Msg as the reason. Distinct from HTTP status and JSON decode errors in the same flow.
Solutions
- Read result.Msg for the API's stated reason
- Check API key validity and account quota
- Adjust the upload request per the reported message
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:156 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/01afbd23c2434bd2.
Report an issue: GitHub.
Appendix: source
Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:156
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 {
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 {View on GitHub (pinned to 988cbb0330)