Tencent/WeKnora · error

web search failed: %w

Error message

web search failed: %w

What it means

The underlying web search provider call failed: webSearchService.Search returned an error (provider outage, invalid provider config, quota, or network issue), so no results are available and the tool returns a failure result wrapping the cause.

Source

Thrown at internal/agent/tools/web_search.go:184

	if tenant != nil {
		searchConfig = types.EffectiveWebSearchConfig(tenant.WebSearchConfig)
	}
	searchConfig.MaxResults = t.maxResults

	// Perform web search
	logger.Infof(
		ctx,
		"[Tool][WebSearch] Performing web search with providerID: %s, maxResults: %d",
		resolvedProviderID,
		searchConfig.MaxResults,
	)
	webResults, err := t.webSearchService.Search(ctx, resolvedProviderID, searchConfig, query)
	if err != nil {
		logger.Errorf(ctx, "[Tool][WebSearch] Web search failed: %v", err)
		return &types.ToolResult{
			Success: false,
			Error:   fmt.Sprintf("web search failed: %v", err),
		}, fmt.Errorf("web search failed: %w", err)
	}

	logger.Infof(ctx, "[Tool][WebSearch] Web search returned %d results", len(webResults))

	// Apply RAG compression if configured
	if len(webResults) > 0 && searchConfig.CompressionMethod != "none" &&
		searchConfig.CompressionMethod != "" {
		// Load session-scoped temp KB state from Redis using WebSearchStateRepository
		tempKBID, seen, ids := t.webSearchStateService.GetWebSearchTempKBState(ctx, t.sessionID)

		// Build questions for RAG compression
		questions := []string{strings.TrimSpace(query)}

		logger.Infof(ctx, "[Tool][WebSearch] Applying RAG compression")
		compressed, kbID, newSeen, newIDs, err := t.webSearchService.CompressWithRAG(
			ctx, t.sessionID, tempKBID, questions, webResults, searchConfig,
			t.knowledgeBaseService, t.knowledgeService, seen, ids,
		)

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Inspect the wrapped provider error for the root cause
  2. Verify provider credentials and resolved provider ID
  3. Retry on transient provider failures or switch provider
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/agent/tools/web_search.go:184 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/1b032ffcd30a95b1. Report an issue: GitHub.