{"record":{"id":"286dba4e48770eba","repo":"Tencent/WeKnora","slug":"web-search-config-is-required","errorCode":null,"errorMessage":"web search config is required","messagePattern":"web search config is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/web_search.go","lineNumber":55,"sourceCode":"\t}\n\n\treturn &WebSearchService{\n\t\tregistry:     registry,\n\t\tproviderRepo: providerRepo,\n\t\ttimeout:      timeout,\n\t}, nil\n}\n\n// Search performs web search using the provider entity identified by providerID.\n// If providerID is empty, it falls back to the deprecated config.Provider field for backward compatibility.\nfunc (s *WebSearchService) Search(\n\tctx context.Context,\n\tproviderID string,\n\tconfig *types.WebSearchConfig,\n\tquery string,\n) ([]*types.WebSearchResult, error) {\n\tif config == nil {\n\t\treturn nil, fmt.Errorf(\"web search config is required\")\n\t}\n\n\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","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/web_search.go#L37-L73","documentation":"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.","triggerScenarios":"Thrown at internal/application/service/web_search.go:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Construct and pass a WebSearchConfig before calling Search","Check the caller's config loading path (session/tenant settings)","Return a client-side 400 so the caller fixes its request"],"exampleFix":null,"handlingStrategy":"validation","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"}