{"record":{"id":"3ae52fd1b54bab24","repo":"Tencent/WeKnora","slug":"create-opensearch-client-w","errorCode":null,"errorMessage":"create opensearch client: %w","messagePattern":"create opensearch client: %w","errorType":"exception","errorClass":null,"httpStatus":500,"severity":"error","filePath":"internal/container/engine_factory.go","lineNumber":142,"sourceCode":"\t\t\treturn err\n\t\t}\n\t\treturn check(\"weaviate gRPC address\", cc.GrpcAddress)\n\tdefault:\n\t\treturn fmt.Errorf(\"vector store engine %q has no SSRF address policy\", store.EngineType)\n\t}\n}\n\n// createOpenSearchEngine builds an OpenSearch k-NN retrieve engine. Mirrors\n// createElasticsearchV8Engine but uses the driver's TLS-hardened client\n// constructor and injects the audit sink. NewRepository probes the cluster\n// (version + k-NN plugin), so an unreachable cluster fails here at\n// registration rather than on first query.\nfunc createOpenSearchEngine(\n\tctx context.Context, store types.VectorStore, auditSink openSearchRepo.AuditSink,\n) (interfaces.RetrieveEngineService, error) {\n\tclient, err := openSearchRepo.NewOpenSearchClient(&store.ConnectionConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create opensearch client: %w\", err)\n\t}\n\t// Env stores share the cluster without a per-store index prefix; DB stores\n\t// fold their (>=16-char) ID into the index name. NewRepository enforces the\n\t// length rule, so map env-store IDs to \"\".\n\tstoreID := store.ID\n\tif types.IsEnvStoreID(storeID) {\n\t\tstoreID = \"\"\n\t}\n\trepo, err := openSearchRepo.NewRepository(ctx, client, storeID, &store.IndexConfig,\n\t\topenSearchRepo.WithAuditSink(auditSink))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create opensearch repository: %w\", err)\n\t}\n\treturn retriever.NewKVHybridRetrieveEngine(repo, types.OpenSearchRetrieverEngineType), nil\n}\n\nfunc createPostgresEngine(store types.VectorStore, db *gorm.DB) (interfaces.RetrieveEngineService, error) {\n\tif store.ConnectionConfig.UseDefaultConnection {","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/container/engine_factory.go#L124-L160","documentation":"createOpenSearchEngine wraps openSearchRepo.NewOpenSearchClient failure. The TLS-hardened client could not be constructed from the store's connection config (bad address/credentials/TLS setup), so the engine can't register.","triggerScenarios":"Thrown at internal/container/engine_factory.go:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the OpenSearch connection config (addr, credentials, TLS)","Inspect the wrapped client-construction error","Fix the store config and re-register the engine"],"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"}