{"record":{"id":"1b032ffcd30a95b1","repo":"Tencent/WeKnora","slug":"web-search-failed-w","errorCode":null,"errorMessage":"web search failed: %w","messagePattern":"web search failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/agent/tools/web_search.go","lineNumber":184,"sourceCode":"\tif tenant != nil {\n\t\tsearchConfig = types.EffectiveWebSearchConfig(tenant.WebSearchConfig)\n\t}\n\tsearchConfig.MaxResults = t.maxResults\n\n\t// Perform web search\n\tlogger.Infof(\n\t\tctx,\n\t\t\"[Tool][WebSearch] Performing web search with providerID: %s, maxResults: %d\",\n\t\tresolvedProviderID,\n\t\tsearchConfig.MaxResults,\n\t)\n\twebResults, err := t.webSearchService.Search(ctx, resolvedProviderID, searchConfig, query)\n\tif err != nil {\n\t\tlogger.Errorf(ctx, \"[Tool][WebSearch] Web search failed: %v\", err)\n\t\treturn &types.ToolResult{\n\t\t\tSuccess: false,\n\t\t\tError:   fmt.Sprintf(\"web search failed: %v\", err),\n\t\t}, fmt.Errorf(\"web search failed: %w\", err)\n\t}\n\n\tlogger.Infof(ctx, \"[Tool][WebSearch] Web search returned %d results\", len(webResults))\n\n\t// Apply RAG compression if configured\n\tif len(webResults) > 0 && searchConfig.CompressionMethod != \"none\" &&\n\t\tsearchConfig.CompressionMethod != \"\" {\n\t\t// Load session-scoped temp KB state from Redis using WebSearchStateRepository\n\t\ttempKBID, seen, ids := t.webSearchStateService.GetWebSearchTempKBState(ctx, t.sessionID)\n\n\t\t// Build questions for RAG compression\n\t\tquestions := []string{strings.TrimSpace(query)}\n\n\t\tlogger.Infof(ctx, \"[Tool][WebSearch] Applying RAG compression\")\n\t\tcompressed, kbID, newSeen, newIDs, err := t.webSearchService.CompressWithRAG(\n\t\t\tctx, t.sessionID, tempKBID, questions, webResults, searchConfig,\n\t\t\tt.knowledgeBaseService, t.knowledgeService, seen, ids,\n\t\t)","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/agent/tools/web_search.go#L166-L202","documentation":"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.","triggerScenarios":"Thrown at internal/agent/tools/web_search.go:184 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped provider error for the root cause","Verify provider credentials and resolved provider ID","Retry on transient provider failures or switch provider"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"988cbb03305e055d8ebb7d46d9ac6cc0803cd074","analyzedAt":"2026-09-02T14:41:08.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}