Tencent/WeKnora · error

web search config is required

Error message

web search config is required

What it means

WebSearchService.Search is called with a nil *types.WebSearchConfig. The config carries provider parameters, max results, and blacklist, so search cannot proceed; this is a caller-contract violation guard, not a provider failure.

Source

Thrown at internal/application/service/web_search.go:55

	}

	return &WebSearchService{
		registry:     registry,
		providerRepo: providerRepo,
		timeout:      timeout,
	}, nil
}

// Search performs web search using the provider entity identified by providerID.
// If providerID is empty, it falls back to the deprecated config.Provider field for backward compatibility.
func (s *WebSearchService) Search(
	ctx context.Context,
	providerID string,
	config *types.WebSearchConfig,
	query string,
) ([]*types.WebSearchResult, error) {
	if config == nil {
		return nil, fmt.Errorf("web search config is required")
	}

	// Resolve the provider
	searchProvider, err := s.resolveProvider(ctx, providerID, config)
	if err != nil {
		return nil, err
	}

	// Set timeout
	timeout := time.Duration(s.timeout) * time.Second
	if timeout == 0 {
		timeout = 10 * time.Second
	}

	ctx, cancel := context.WithTimeout(ctx, timeout)
	defer cancel()

	// Perform search

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Construct and pass a WebSearchConfig before calling Search
  2. Check the caller's config loading path (session/tenant settings)
  3. Return a client-side 400 so the caller fixes its request
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/application/service/web_search.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/286dba4e48770eba. Report an issue: GitHub.