{"record":{"id":"0f263a11da306e86","repo":"Tencent/WeKnora","slug":"custom-postgres-connections-not-yet-supported-use","errorCode":null,"errorMessage":"custom postgres connections not yet supported; use use_default_connection=true","messagePattern":"custom postgres connections not yet supported; use use_default_connection=true","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"internal/container/engine_factory.go","lineNumber":166,"sourceCode":"\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 {\n\t\trepo := postgresRepo.NewPostgresRetrieveEngineRepository(db)\n\t\treturn retriever.NewKVHybridRetrieveEngine(repo, types.PostgresRetrieverEngineType), nil\n\t}\n\t// Phase 1: only UseDefaultConnection is supported.\n\t// Custom connections require connection pool management and migration handling.\n\treturn nil, fmt.Errorf(\"custom postgres connections not yet supported; use use_default_connection=true\")\n}\n\nfunc createSQLiteEngine(_ types.VectorStore, db *gorm.DB) (interfaces.RetrieveEngineService, error) {\n\trepo := sqliteRetrieverRepo.NewSQLiteRetrieveEngineRepository(db)\n\treturn retriever.NewKVHybridRetrieveEngine(repo, types.SQLiteRetrieverEngineType), nil\n}\n\nfunc createElasticsearchEngine(store types.VectorStore, cfg *config.Config) (interfaces.RetrieveEngineService, error) {\n\tcc := store.ConnectionConfig\n\t// Version-based v7/v8 SDK selection.\n\t// Version is auto-detected by PR2's TestConnection and saved to connection_config.\n\t// Empty version defaults to v8 (latest SDK).\n\tif isESv7(cc.Version) {\n\t\treturn createElasticsearchV7Engine(store, cfg)\n\t}\n\treturn createElasticsearchV8Engine(store, cfg)\n}\n","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/Tencent/WeKnora/blob/988cbb03305e055d8ebb7d46d9ac6cc0803cd074/internal/container/engine_factory.go#L148-L184","documentation":"createPostgresEngine refuses stores with use_default_connection=false: custom Postgres connections are not implemented, so the only supported mode is reusing the application's default GORM connection. Explicit guard against an unimplemented feature.","triggerScenarios":"Thrown at internal/container/engine_factory.go:166 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set use_default_connection=true on the postgres vector store","Implement custom-connection support if needed","Reject the store config at the input boundary as well"],"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"}