{"record":{"id":"0b03fbd1f8a9e5f6","repo":"Tencent/WeKnora","slug":"web-search-failed-w-0b03fb","errorCode":null,"errorMessage":"web search failed: %w","messagePattern":"web search failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/web_search.go","lineNumber":76,"sourceCode":"\t// Resolve the provider\n\tsearchProvider, err := s.resolveProvider(ctx, providerID, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set timeout\n\ttimeout := time.Duration(s.timeout) * time.Second\n\tif timeout == 0 {\n\t\ttimeout = 10 * time.Second\n\t}\n\n\tctx, cancel := context.WithTimeout(ctx, timeout)\n\tdefer cancel()\n\n\t// Perform search\n\tresults, err := searchProvider.Search(ctx, query, config.MaxResults, config.IncludeDate)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"web search failed: %w\", err)\n\t}\n\n\t// Apply blacklist filtering\n\tresults = s.filterBlacklist(results, config.Blacklist)\n\n\treturn results, nil\n}\n\n// resolveProvider resolves a WebSearchProvider instance from either:\n// 1. A provider entity ID (new path) — loads from DB, creates via registry\n// 2. The deprecated config.Provider field (backward compatibility) — creates with empty params\nfunc (s *WebSearchService) resolveProvider(\n\tctx context.Context,\n\tproviderID string,\n\tcfg *types.WebSearchConfig,\n) (interfaces.WebSearchProvider, error) {\n\t// New path: load provider entity from DB\n\tif providerID != \"\" {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/web_search.go#L58-L94","documentation":"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'.","triggerScenarios":"Thrown at internal/application/service/web_search.go:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped provider error (auth, quota, network, timeout)","Verify provider API key and parameters","Retry with backoff for transient network/provider errors","Check the configured timeout is sufficient for the provider"],"exampleFix":null,"handlingStrategy":"retry","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"}