{"record":{"id":"1498f57380983c9c","repo":"vxcontrol/pentagi","slug":"failed-to-do-request-v","errorCode":null,"errorMessage":"failed to do request: %v","messagePattern":"failed to do request: (.+?)","errorType":"exception","errorClass":"RetryableError","httpStatus":null,"severity":"warning","filePath":"backend/pkg/tools/searchers/firecrawl.go","lineNumber":167,"sourceCode":"\t\t},\n\t}\n\treqBody, err := json.Marshal(reqPayload)\n\tif err != nil {\n\t\treturn \"\", Fatal(fmt.Errorf(\"failed to marshal request body: %v\", err))\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, f.searchURL(), bytes.NewBuffer(reqBody))\n\tif err != nil {\n\t\treturn \"\", Fatal(fmt.Errorf(\"failed to build request: %v\", err))\n\t}\n\n\treq = req.WithContext(ctx)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+f.apiKey())\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn \"\", Retryable(fmt.Errorf(\"failed to do request: %v\", err), 0)\n\t}\n\tdefer resp.Body.Close()\n\n\treturn f.parseHTTPResponse(ctx, query, resp)\n}\n\nfunc (f *firecrawl) parseHTTPResponse(ctx context.Context, query string, resp *http.Response) (string, error) {\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\tvar respBody firecrawlSearchResult\n\t\tif err := json.NewDecoder(resp.Body).Decode(&respBody); err != nil {\n\t\t\treturn \"\", Fatal(fmt.Errorf(\"failed to decode response body: %v\", err))\n\t\t}\n\t\tif !respBody.Success {\n\t\t\tif respBody.Error != \"\" {\n\t\t\t\treturn \"\", Fatal(fmt.Errorf(\"request failed: %s\", respBody.Error))\n\t\t\t}\n\t\t\treturn \"\", Fatal(fmt.Errorf(\"request failed\"))","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/searchers/firecrawl.go#L149-L185","documentation":"client.Do(req) failed at the transport level — DNS failure, connection refused/refused proxy, TLS handshake, or context cancellation. Because transport errors are often transient, firecrawl returns a RetryableError (retryAfter=0).","triggerScenarios":"Network outage or wrong host/port for the Firecrawl endpoint, proxy down, ctx cancelled (deadline) mid-request while calling search.","commonSituations":"Container without egress to api.firecrawl.dev, DNS misconfig, firewall rules, expired TLS cert on a self-hosted Firecrawl, request deadline exceeded.","solutions":["Retry via the orchestrator — the error is typed retryable.","Verify network egress from the container: curl -v https://<firecrawl-url>.","Check DNS/proxy settings and firewall rules for the deployment.","If self-hosting Firecrawl, confirm the service is up and its TLS cert valid.","Increase the request/flow timeout if wrapped cause is context deadline exceeded."],"exampleFix":"// before: no egress test, silent misconfig\nFIRECRAWL_URL=https://firecrawl.internal:9443\n// after: verify first\ncurl -v https://firecrawl.internal:9443/  # then fix port/service","handlingStrategy":"retry","validationCode":"// reachability preflight\nctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)\ndefer cancel()\nreq, _ := http.NewRequestWithContext(ctx, http.MethodHead, cfg.ServerURL, nil)\nif _, err := http.DefaultClient.Do(req); err != nil { return fmt.Errorf(\"engine unreachable: %w\", err) }","typeGuard":"func isNetworkError(err error) bool {\n  var ne net.Error\n  return errors.As(err, &ne) || errors.Is(err, context.DeadlineExceeded) || errors.Is(err, syscall.ECONNREFUSED)\n}","tryCatchPattern":"err := searcher.Handle(ctx, q)\nif err != nil && searchers.IsRetryable(err) {\n  select {\n  case <-time.After(backoff):\n  case <-ctx.Done():\n  }\n  retry()\n}","preventionTips":["Grant container egress to the engine host (firewall/DNS check).","Set realistic request timeouts and deadlines.","Monitor self-hosted Firecrawl uptime and cert expiry.","Use the retryable/fatal classification instead of blanket retries."],"tags":["network","transport","retryable","firecrawl"],"backgroundTag":"network-request-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}