vxcontrol/pentagi · error · Fatal
failed to create http client: %w
Error message
failed to create http client: %w
What it means
system.GetHTTPClient(s.cfg) builds the outbound HTTP client from the searcher config (proxy/TLS settings); when construction fails the searcher returns a Fatal error and gives up without retrying. GetHTTPClient typically fails on invalid proxy configuration or bad TLS material.
Source
Thrown at backend/pkg/tools/searchers/sploitus.go:125
// search calls the Sploitus API and returns a formatted markdown result string
func (s *sploitus) search(ctx context.Context, query, exploitType, sort string, limit int) (string, error) {
reqBody := sploitusRequest{
Query: query,
Type: exploitType,
Sort: sort,
Title: false, // search only for titles
Offset: 0,
}
bodyBytes, err := json.Marshal(reqBody)
if err != nil {
return "", Fatal(fmt.Errorf("failed to marshal request body: %w", err))
}
client, err := system.GetHTTPClient(s.cfg)
if err != nil {
return "", Fatal(fmt.Errorf("failed to create http client: %w", err))
}
client.Timeout = sploitusRequestTimeout
req, err := http.NewRequestWithContext(ctx, http.MethodPost, sploitusAPIURL, bytes.NewReader(bodyBytes))
if err != nil {
return "", Fatal(fmt.Errorf("failed to create request: %w", err))
}
// Build referer with query to mimic browser behavior
referer := fmt.Sprintf("https://sploitus.com/?query=%s", url.QueryEscape(query))
// Mimic Chrome browser headers to bypass Cloudflare protection
req.Header.Set("Accept", "application/json")
req.Header.Set("Accept-Language", "en-US,en;q=0.9")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Origin", "https://sploitus.com")
req.Header.Set("Referer", referer)View on GitHub (pinned to ea665308ba)
Solutions
- Check the wrapped error for 'unknown scheme' or 'proxy' wording and fix the proxy URL in env/config (HTTP_PROXY, HTTPS_PROXY, NO_PROXY)
- Validate any custom CA bundle path referenced by the config exists and contains valid PEM certificates
- Unset proxy variables to confirm the error disappears, then re-add them one by one
Example fix
// before export HTTP_PROXY="proxy.corp.local:8080" // missing scheme // after export HTTP_PROXY="http://proxy.corp.local:8080"
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(s.cfg)
if err != nil {
return "", Fatal(fmt.Errorf("failed to create http client: %w", err))
} Prevention
- Validate proxy URLs at container startup, not per request
- Check CA bundle paths exist and are valid PEM before deploy
- Smoke-test outbound HTTPS (curl https://api.example.com) in CI/container entrypoint
When it happens
Trigger: Handle() on the Sploitus searcher calls system.GetHTTPClient(s.cfg) after marshaling the body; it fails when cfg contains an unparsable proxy URL or malformed TLS/transport options.
Common situations: HTTP_PROXY/HTTPS_PROXY env vars contain an invalid URL (e.g. missing scheme), a custom CA file configured for the container does not exist or is not valid PEM, or proxy credentials are malformed.
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/b1bad92cab107cf2.
Report an issue: GitHub.