{"record":{"id":"065812c7e6902fd1","repo":"Tencent/WeKnora","slug":"failed-to-load-web-search-provider-s-w","errorCode":null,"errorMessage":"failed to load web search provider %s: %w","messagePattern":"failed to load web search provider (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/application/service/web_search.go","lineNumber":102,"sourceCode":"\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 != \"\" {\n\t\ttenantID, ok := types.TenantIDFromContext(ctx)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"workspace ID not found in context\")\n\t\t}\n\n\t\tentity, err := s.providerRepo.GetByID(ctx, tenantID, providerID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to load web search provider %s: %w\", providerID, err)\n\t\t}\n\t\tif entity == nil {\n\t\t\treturn nil, fmt.Errorf(\"web search provider not found: %s\", providerID)\n\t\t}\n\n\t\tparams := mergeProxyFromWebSearchConfig(entity.Parameters, cfg)\n\t\tprovider, err := s.registry.CreateProvider(string(entity.Provider), params)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create provider %s (%s): %w\", entity.Name, entity.Provider, err)\n\t\t}\n\t\treturn provider, nil\n\t}\n\n\t// Backward compatibility: use the deprecated config.Provider field\n\tif cfg.Provider != \"\" {\n\t\tlogger.Warnf(ctx, \"Using deprecated WebSearchConfig.Provider field: %s. Please migrate to WebSearchProviderEntity.\", cfg.Provider)\n\t\tparams := mergeProxyFromWebSearchConfig(types.WebSearchProviderParameters{\n\t\t\tAPIKey: cfg.APIKey,","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/application/service/web_search.go#L84-L120","documentation":"resolveProvider wraps the repository error from providerRepo.GetByID when loading the configured web search provider entity. The provider row could not be read (DB error or repository failure), so no search provider instance can be built.","triggerScenarios":"Thrown at internal/application/service/web_search.go:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check DB connectivity and the provider repository","Verify the providerID references an existing row for this tenant","Retry the search after the repository recovers"],"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"}