vxcontrol/pentagi · error · Fatal
failed to create http client: %w
Error message
failed to create http client: %w
What it means
The Tavily searcher calls system.GetHTTPClient(t.cfg) to build its outbound HTTP client; failure (invalid proxy URL, bad TLS config) yields a Fatal error with no retry. Identical in nature to the Sploitus client-creation error — it reflects environment/config, not the Tavily API.
Source
Thrown at backend/pkg/tools/searchers/tavily.go:106
langfuse.WithEventMetadata(langfuse.Metadata{
"engine": "tavily",
"query": req.Query,
"max_results": req.MaxResults,
"error": err.Error(),
}),
)
obs.LogErrorOrCancel(logger, err, "failed to search in tavily")
return "", err
}
return result, nil
}
func (t *tavily) search(ctx context.Context, query string, maxResults int) (string, error) {
client, err := system.GetHTTPClient(t.cfg)
if err != nil {
return "", Fatal(fmt.Errorf("failed to create http client: %w", err))
}
reqPayload := tavilyRequest{
Query: query,
ApiKey: t.apiKey(),
Topic: "general",
SearchDepth: "advanced",
IncludeImages: false,
IncludeAnswer: true,
IncludeRawContent: true,
MaxResults: maxResults,
}
reqBody, err := json.Marshal(reqPayload)
if err != nil {
return "", Fatal(fmt.Errorf("failed to marshal request body: %v", err))
}
req, err := http.NewRequest(http.MethodPost, tavilyURL, bytes.NewBuffer(reqBody))View on GitHub (pinned to ea665308ba)
Solutions
- Fix the proxy URL named in the wrapped error (scheme required, e.g. http://host:port)
- Validate custom CA bundle path/PEM content referenced by the config
- Test with proxies unset to isolate whether proxy config is the cause
Example fix
// before HTTPS_PROXY=socks://bad host:1080 // after HTTPS_PROXY=socks5://proxy.internal:1080
Defensive patterns
Strategy: validation
Validate before calling
if proxy := os.Getenv("HTTPS_PROXY"); proxy != "" {
if _, err := url.Parse(proxy); err != nil {
log.Fatalf("invalid HTTPS_PROXY %q: %v", proxy, err)
}
} Try / catch
client, err := system.GetHTTPClient(t.cfg)
if err != nil {
return "", Fatal(fmt.Errorf("failed to create http client: %w", err))
} Prevention
- Validate proxy and TLS config at startup before any search runs
- Keep .env and docker-compose proxy settings consistent
- Smoke-test outbound HTTPS to api.tavily.com in the deployment check
When it happens
Trigger: tavily.search() (called from Handle) invokes system.GetHTTPClient(t.cfg) before building the request; fails when cfg has an unparsable proxy or invalid transport/TLS options.
Common situations: Invalid HTTP_PROXY/HTTPS_PROXY URL in the container environment, nonexistent or malformed CA bundle configured for the proxy, or corrupted config after editing .env/docker-compose.
Related errors
- failed to create http client: %w
- failed to create http client: %w
- failed to create http client: %w
- failed to create http client: %w
- failed to create http client: %w
AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01).
Data as JSON: /api/errors/bcdd8e7903ce12be.
Report an issue: GitHub.