{"record":{"id":"594481e8450cf872","repo":"vxcontrol/pentagi","slug":"failed-to-create-http-client-w-594481","errorCode":null,"errorMessage":"failed to create http client: %w","messagePattern":"failed to create http client: %w","errorType":"exception","errorClass":"FatalError","httpStatus":null,"severity":"error","filePath":"backend/pkg/tools/searchers/firecrawl.go","lineNumber":137,"sourceCode":"\t\t\tlangfuse.WithEventMetadata(langfuse.Metadata{\n\t\t\t\t\"engine\":      \"firecrawl\",\n\t\t\t\t\"query\":       req.Query,\n\t\t\t\t\"max_results\": req.MaxResults,\n\t\t\t\t\"error\":       err.Error(),\n\t\t\t}),\n\t\t)\n\n\t\tobs.LogErrorOrCancel(logger, err, \"failed to search in firecrawl\")\n\t\treturn \"\", err\n\t}\n\n\treturn result, nil\n}\n\nfunc (f *firecrawl) search(ctx context.Context, query string, maxResults int) (string, error) {\n\tclient, err := system.GetHTTPClient(f.cfg)\n\tif err != nil {\n\t\treturn \"\", Fatal(fmt.Errorf(\"failed to create http client: %w\", err))\n\t}\n\n\t// sources is intentionally omitted: /v2/search defaults to [\"web\"], which is\n\t// all this tool consumes, and it avoids the string-vs-object shape ambiguity\n\t// that field carries across the API/SDK layers.\n\treqPayload := firecrawlRequest{\n\t\tQuery: query,\n\t\tLimit: maxResults,\n\t\tScrapeOptions: &firecrawlScrapeOptions{\n\t\t\tFormats:         []string{\"markdown\"},\n\t\t\tOnlyMainContent: true,\n\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","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/searchers/firecrawl.go#L119-L155","documentation":"The firecrawl searcher's search step calls system.GetHTTPClient(f.cfg) to build its HTTP client; when that fails (invalid proxy config, TLS setup), it wraps the cause in a FatalError since retrying with the same config will not help.","triggerScenarios":"f.cfg contains an unreachable/malformed proxy URL or invalid TLS material, causing system.GetHTTPClient to return an error before any network call.","commonSituations":"Wrong PROXY_* env vars, self-signed CA not mounted, misconfigured HTTP_PROXY/HTTPS_PROXY for the container.","solutions":["Fix the proxy/TLS configuration referenced by f.cfg (env vars) and restart.","Test the proxy URL is reachable: curl -x <proxy> https://firecrawl.dev.","Remove the proxy setting if not required for this deployment.","Check CA certificate mounting if TLS errors are the wrapped cause."],"exampleFix":"// before: bad proxy\nSEARCH_FIRECRAWL_PROXY=http://127.0.0.1:9999\n// after\nSEARCH_FIRECRAWL_PROXY=http://proxy.internal:3128  # reachable host","handlingStrategy":"validation","validationCode":"if cfg.ProxyURL != \"\" {\n  u, err := url.Parse(cfg.ProxyURL)\n  if err != nil || u.Host == \"\" { return fmt.Errorf(\"invalid proxy url: %v\", err) }\n  if conn, err := net.DialTimeout(\"tcp\", u.Host, 3*time.Second); err != nil { return err } else { conn.Close() }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Smoke-test proxy connectivity at deployment startup.","Keep proxy env vars consistent across services.","Mount required CA certs when using TLS-intercepting proxies."],"tags":["http-client","configuration","fatal","firecrawl"],"backgroundTag":"http-client-creation-failed","analyzedSha":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}