Tencent/WeKnora · error

API key is required for Bing provider

Error message

API key is required for Bing provider

What it means

Constructor validation in NewBingProvider: params.APIKey is empty, but the Bing Search API authenticates exclusively by API key. The provider refuses to be created (no environment-variable fallback), so a Bing provider without credentials never enters the registry and no doomed request is attempted.

Source

Thrown at internal/infrastructure/web_search/bing.go:55

type bingFreshness string

const (
	bingFreshnessDay   = "Day"
	bingFreshnessWeek  = "Week"
	bingFreshnessMonth = "Month"
)

// BingProvider implements web search using Bing Search API
type BingProvider struct {
	client  *http.Client
	baseURL string
	apiKey  string
}

// NewBingProvider creates a new Bing provider from parameters (no environment variables).
func NewBingProvider(params types.WebSearchProviderParameters) (interfaces.WebSearchProvider, error) {
	if params.APIKey == "" {
		return nil, fmt.Errorf("API key is required for Bing provider")
	}
	client, err := NewSearchHTTPClient(defaultBingTimeout, params.ProxyURL)
	if err != nil {
		return nil, err
	}
	return &BingProvider{
		client:  client,
		baseURL: defaultBingSearchURL, // Hardcoded — not tenant-configurable
		apiKey:  params.APIKey,
	}, nil
}

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

// Search performs a web search using Bing Search API

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Configure the Bing API key in the provider parameters
  2. Choose a different provider if no Bing credentials exist
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/infrastructure/web_search/bing.go:55 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/8813dd3df78cf691. Report an issue: GitHub.