Tencent/WeKnora · error
create Baidu HTTP client: %w
Error message
create Baidu HTTP client: %w
What it means
Returned by NewBaiduProvider when NewSearchHTTPClient fails to build the outbound HTTP client — typically an invalid proxy_url that failed validation, or the default transport not being *http.Transport.
Source
Thrown at internal/infrastructure/web_search/baidu.go:44
maxBaiduResults = 50
maxBaiduQueryUnits = 72
)
// BaiduProvider implements web search using Baidu AI Search API.
type BaiduProvider struct {
client *http.Client
baseURL string
apiKey string
}
// NewBaiduProvider creates a new Baidu web search provider from parameters.
func NewBaiduProvider(params types.WebSearchProviderParameters) (interfaces.WebSearchProvider, error) {
if params.APIKey == "" {
return nil, fmt.Errorf("API key is required for Baidu provider")
}
client, err := NewSearchHTTPClient(defaultBaiduTimeout, params.ProxyURL)
if err != nil {
return nil, fmt.Errorf("create Baidu HTTP client: %w", err)
}
return &BaiduProvider{
client: client,
baseURL: defaultBaiduWebSearchURL, // Hardcoded — not tenant-configurable
apiKey: params.APIKey,
}, nil
}
// Name returns the provider name.
func (p *BaiduProvider) Name() string {
return "baidu"
}
// Search performs a web search using Baidu AI Search API.
func (p *BaiduProvider) Search(
ctx context.Context,
query string,
maxResults int,View on GitHub (pinned to 988cbb0330)
Solutions
- Check the proxy_url parameter for correct format (scheme://host:port)
- Remove the proxy setting if none is required
- Verify the environment's default transport is unmodified
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/infrastructure/web_search/baidu.go:44 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/591968c079e74874.
Report an issue: GitHub.