{"record":{"id":"07399b478943a471","repo":"Tencent/WeKnora","slug":"create-request-w-07399b","errorCode":null,"errorMessage":"create request: %w","messagePattern":"create request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/infrastructure/docparser/paddleocr_vl_cloud_converter.go","lineNumber":140,"sourceCode":"\t\tfileName = \"document.\" + ext\n\t}\n\n\tvar body bytes.Buffer\n\twriter := multipart.NewWriter(&body)\n\t_ = writer.WriteField(\"model\", c.model)\n\t_ = writer.WriteField(\"optionalPayload\", string(optional))\n\tpart, err := writer.CreateFormFile(\"file\", filepath.Base(fileName))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"create form file: %w\", err)\n\t}\n\tif _, err := part.Write(content); err != nil {\n\t\treturn \"\", fmt.Errorf(\"write file content: %w\", err)\n\t}\n\twriter.Close()\n\n\thttpReq, err := http.NewRequestWithContext(ctx, http.MethodPost, c.baseURL, &body)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"create request: %w\", err)\n\t}\n\thttpReq.Header.Set(\"Authorization\", \"bearer \"+c.token)\n\thttpReq.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\n\tclient := utils.NewSSRFSafeHTTPClient(utils.SSRFSafeHTTPClientConfig{Timeout: 60 * time.Second, MaxRedirects: 5})\n\tresp, err := client.Do(httpReq)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"HTTP request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\trespBody, _ := io.ReadAll(resp.Body)\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"API status %d: %s\", resp.StatusCode, string(respBody))\n\t}\n\n\tvar result paddleOCRVLCloudSubmitResponse\n\tif err := json.Unmarshal(respBody, &result); err != nil {","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/infrastructure/docparser/paddleocr_vl_cloud_converter.go#L122-L158","documentation":"submitJob constructs the outbound POST with http.NewRequestWithContext using c.baseURL. If the URL is invalid/unparseable (http.NewRequestWithContext error) or the SSRF-safe client's Do call fails (DNS failure, connection refused, TLS error, timeout, context cancelled), the error is wrapped as 'create request' or surfaces from this submission step. The upload never reached the PaddleOCR-VL cloud API.","triggerScenarios":"Read -> submitJob: c.baseURL is malformed (missing scheme, bad characters) causing NewRequestWithContext to fail; or client.Do errors on network unreachable, DNS failure, connection refused, TLS handshake failure, 60s timeout, or ctx cancellation.","commonSituations":"Missing/mistyped PADDLEOCR base URL env var (e.g. forgot https://); egress firewall blocking the cloud endpoint; DNS misconfiguration in the cluster; corporate proxy required but not configured; cloud endpoint temporarily down.","solutions":["Check the wrapped cause: URL parse error vs. transport error (connection refused / DNS / TLS / timeout)","Verify the configured base URL is absolute and correct, including the https:// scheme","Test connectivity to the endpoint from the deployment environment (curl / egress rules)","If behind a proxy, configure proxy settings for the HTTP client","Retry on transient timeouts; increase the 60s timeout for large uploads"],"exampleFix":"// before\nbaseURL := \"api.paddleocr.example.com/v1/jobs\" // missing scheme -> parse error\n// after\nbaseURL := \"https://api.paddleocr.example.com/v1/jobs\"","handlingStrategy":"validation","validationCode":"u, err := url.Parse(c.baseURL)\nif err != nil || u.Scheme == \"\" || u.Host == \"\" {\n    return fmt.Errorf(\"invalid PaddleOCR-VL baseURL %q: %w\", c.baseURL, err)\n}\nif err := validateMinerUOutboundURL(c.baseURL); err != nil { return err } // or equivalent SSRF check","typeGuard":"func isRequestCreationError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"create request\")\n}","tryCatchPattern":"out, err := reader.Read(ctx, req)\nif isRequestCreationError(err) {\n    if errors.Is(err, context.DeadlineExceeded) || isNetTransient(err) {\n        out, err = retryWithBackoff(3, reader.Read, ctx, req)\n    }\n    if err != nil { return err }\n}","preventionTips":["Validate baseURL (absolute, https) at configuration load time","Run a startup connectivity check against the cloud endpoint","Confirm egress/proxy rules allow the API host before deploying","Keep the 60s timeout reviewed against your largest document uploads"],"tags":["http","network","paddleocr","configuration","docparser"],"backgroundTag":"http-request-create-failed","analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}