Tencent/WeKnora · error

web search failed

Error message

web search failed: %w

What it means

Search wraps any error returned by the resolved search provider's Search call (network failure, provider API error, timeout within the per-call deadline). The underlying cause is preserved for diagnosis; the caller gets a generic 'web search failed'.

Solutions

  1. Inspect the wrapped provider error (auth, quota, network, timeout)
  2. Verify provider API key and parameters
  3. Retry with backoff for transient network/provider errors
  4. Check the configured timeout is sufficient for the provider
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/application/service/web_search.go:76 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/0b03fbd1f8a9e5f6. Report an issue: GitHub.

Appendix: source

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

	// 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
	results, err := searchProvider.Search(ctx, query, config.MaxResults, config.IncludeDate)
	if err != nil {
		return nil, fmt.Errorf("web search failed: %w", err)
	}

	// Apply blacklist filtering
	results = s.filterBlacklist(results, config.Blacklist)

	return results, nil
}

// resolveProvider resolves a WebSearchProvider instance from either:
// 1. A provider entity ID (new path) — loads from DB, creates via registry
// 2. The deprecated config.Provider field (backward compatibility) — creates with empty params
func (s *WebSearchService) resolveProvider(
	ctx context.Context,
	providerID string,
	cfg *types.WebSearchConfig,
) (interfaces.WebSearchProvider, error) {
	// New path: load provider entity from DB
	if providerID != "" {

View on GitHub (pinned to 988cbb0330)