Tencent/WeKnora · error
create PUT request: %w
Error message
create PUT request: %w
What it means
HTTP client error in MinerUCloudReader.uploadFile: http.NewRequestWithContext could not construct the PUT request for the presigned upload URL. The %w retains the net/http cause; it fires before any bytes are sent to object storage.
Source
Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:169
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()
if resp.StatusCode >= 300 {
return fmt.Errorf("PUT upload status %d", resp.StatusCode)
}
logger.Infof(context.Background(), "[MinerUCloud] file uploaded, status=%d", resp.StatusCode)
return nil
}
// --- polling ---
View on GitHub (pinned to 988cbb0330)
Solutions
- Log the upload URL to check its format
- Re-request upload URLs via batch apply if stale/malformed
- Retry the full upload flow
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at internal/infrastructure/docparser/mineru_cloud_converter.go:169 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/41792208a5fca325.
Report an issue: GitHub.