{"record":{"id":"55fd5c23f56f5f48","repo":"Tencent/WeKnora","slug":"create-elasticsearch-v8-client-w","errorCode":null,"errorMessage":"create elasticsearch v8 client: %w","messagePattern":"create elasticsearch v8 client: %w","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"internal/container/engine_factory.go","lineNumber":204,"sourceCode":"func isESv7(version string) bool {\n\treturn strings.HasPrefix(version, \"7.\")\n}\n\nfunc createElasticsearchV8Engine(store types.VectorStore, cfg *config.Config) (interfaces.RetrieveEngineService, error) {\n\tcc := store.ConnectionConfig\n\tif err := utils.ValidateURLForSSRF(cc.Addr); err != nil {\n\t\treturn nil, fmt.Errorf(\"elasticsearch address failed SSRF validation: %w\", err)\n\t}\n\tclient, err := elasticsearch.NewTypedClient(elasticsearch.Config{\n\t\tAddresses: []string{cc.Addr},\n\t\tUsername:  cc.Username,\n\t\tPassword:  cc.Password,\n\t\tTransport: &utils.SSRFValidatingRoundTripper{\n\t\t\tBase: utils.NewSSRFSafeTransport(utils.DefaultSSRFSafeHTTPClientConfig()),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create elasticsearch v8 client: %w\", err)\n\t}\n\trepo := elasticsearchRepoV8.NewElasticsearchEngineRepository(client, cfg, &store.IndexConfig)\n\treturn retriever.NewKVHybridRetrieveEngine(repo, types.ElasticsearchRetrieverEngineType), nil\n}\n\nfunc createElasticsearchV7Engine(store types.VectorStore, cfg *config.Config) (interfaces.RetrieveEngineService, error) {\n\tcc := store.ConnectionConfig\n\tif err := utils.ValidateURLForSSRF(cc.Addr); err != nil {\n\t\treturn nil, fmt.Errorf(\"elasticsearch address failed SSRF validation: %w\", err)\n\t}\n\tclient, err := esv7.NewClient(esv7.Config{\n\t\tAddresses: []string{cc.Addr},\n\t\tUsername:  cc.Username,\n\t\tPassword:  cc.Password,\n\t\tTransport: &utils.SSRFValidatingRoundTripper{\n\t\t\tBase: utils.NewSSRFSafeTransport(utils.DefaultSSRFSafeHTTPClientConfig()),\n\t\t},\n\t})","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/container/engine_factory.go#L186-L222","documentation":"createElasticsearchV8Engine wraps the elasticsearch NewTypedClient construction error (invalid address format, unusable config). The v8 SDK client could not be built, so the ES retrieve engine cannot register.","triggerScenarios":"Thrown at internal/container/engine_factory.go:204 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the ES address URL format and scheme","Check credentials/TLS settings in connection_config","Fix the store config and retry registration"],"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"}