Tencent/WeKnora · error

create Ollama HTTP client: %w

Error message

create Ollama HTTP client: %w

What it means

Returned by NewOllamaProvider when NewSearchHTTPClient fails to construct the HTTP client — most commonly an invalid proxy_url that failed SSRF-aware validation, or the default transport not being *http.Transport.

Source

Thrown at internal/infrastructure/web_search/ollama.go:40

	defaultOllamaResults      = 5
	maxOllamaResults          = 10 // Ollama限制最多10个结果
)

// OllamaProvider implements web search using Ollama Cloud API
type OllamaProvider struct {
	client  *http.Client
	baseURL string
	apiKey  string
}

// NewOllamaProvider creates a new Ollama web search provider from parameters.
func NewOllamaProvider(params types.WebSearchProviderParameters) (interfaces.WebSearchProvider, error) {
	if params.APIKey == "" {
		return nil, fmt.Errorf("API key is required for Ollama provider")
	}
	client, err := NewSearchHTTPClient(defaultOllamaTimeout, params.ProxyURL)
	if err != nil {
		return nil, fmt.Errorf("create Ollama HTTP client: %w", err)
	}
	return &OllamaProvider{
		client:  client,
		baseURL: defaultOllamaWebSearchURL, // Hardcoded — not tenant-configurable
		apiKey:  params.APIKey,
	}, nil
}

// Name returns the provider name
func (p *OllamaProvider) Name() string {
	return "ollama"
}

// Search performs a web search using Ollama Cloud API
func (p *OllamaProvider) Search(
	ctx context.Context,
	query string,
	maxResults int,

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Check the proxy_url format (scheme://host:port)
  2. Remove the proxy setting if unnecessary
  3. Verify the process default transport is unmodified
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/infrastructure/web_search/ollama.go:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/818e70300bb54209. Report an issue: GitHub.