Tencent/WeKnora · error

create poll request: %w

Error message

create poll request: %w

What it means

HTTP client error in PaddleOCRVLCloudReader.pollJob: constructing the GET poll request for the job status URL failed at http.NewRequestWithContext. The %w keeps the net/http cause; it fires inside the polling loop after the cancellation guard passed, before the request is sent.

Source

Thrown at internal/infrastructure/docparser/paddleocr_vl_cloud_converter.go:202

func (c *PaddleOCRVLCloudReader) pollJob(ctx context.Context, jobID string) (string, error) {
	deadline := time.Now().Add(paddleOCRVLCloudTimeout)
	pollCount := 0
	url := c.baseURL + "/" + jobID

	for time.Now().Before(deadline) {
		// Bail out promptly when the caller cancels (task cancelled / timed
		// out) instead of spinning: client.Do would fail immediately and
		// sleepCtx returns at once on a cancelled ctx, so without this guard
		// the loop busy-hammers the cloud API and floods logs until deadline.
		if err := ctx.Err(); err != nil {
			return "", err
		}
		pollCount++

		httpReq, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
		if err != nil {
			return "", fmt.Errorf("create poll request: %w", err)
		}
		httpReq.Header.Set("Authorization", "bearer "+c.token)

		client := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 30 * time.Second, MaxRedirects: 5})
		resp, err := client.Do(httpReq)
		if err != nil {
			logger.Errorf(context.Background(), "[PaddleOCR-VL Cloud] poll #%d failed: %v", pollCount, err)
			sleepCtx(ctx, paddleOCRVLCloudPollInterval)
			continue
		}
		respBody, _ := io.ReadAll(resp.Body)
		resp.Body.Close()

		if resp.StatusCode != http.StatusOK {
			logger.Errorf(context.Background(), "[PaddleOCR-VL Cloud] poll #%d status %d: %s", pollCount, resp.StatusCode, string(respBody))
			sleepCtx(ctx, paddleOCRVLCloudPollInterval)
			continue
		}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check the base URL and job ID form a valid URL
  2. Log the composed polling URL
  3. Retry the Read flow if the URL config is corrected
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/infrastructure/docparser/paddleocr_vl_cloud_converter.go:202 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/9380d14d23f8b7e3. Report an issue: GitHub.