Tencent/WeKnora · error

custom postgres connections not yet supported; use use_defau

Error message

custom postgres connections not yet supported; use use_default_connection=true

What it means

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.

Source

Thrown at internal/container/engine_factory.go:166

	if types.IsEnvStoreID(storeID) {
		storeID = ""
	}
	repo, err := openSearchRepo.NewRepository(ctx, client, storeID, &store.IndexConfig,
		openSearchRepo.WithAuditSink(auditSink))
	if err != nil {
		return nil, fmt.Errorf("create opensearch repository: %w", err)
	}
	return retriever.NewKVHybridRetrieveEngine(repo, types.OpenSearchRetrieverEngineType), nil
}

func createPostgresEngine(store types.VectorStore, db *gorm.DB) (interfaces.RetrieveEngineService, error) {
	if store.ConnectionConfig.UseDefaultConnection {
		repo := postgresRepo.NewPostgresRetrieveEngineRepository(db)
		return retriever.NewKVHybridRetrieveEngine(repo, types.PostgresRetrieverEngineType), nil
	}
	// Phase 1: only UseDefaultConnection is supported.
	// Custom connections require connection pool management and migration handling.
	return nil, fmt.Errorf("custom postgres connections not yet supported; use use_default_connection=true")
}

func createSQLiteEngine(_ types.VectorStore, db *gorm.DB) (interfaces.RetrieveEngineService, error) {
	repo := sqliteRetrieverRepo.NewSQLiteRetrieveEngineRepository(db)
	return retriever.NewKVHybridRetrieveEngine(repo, types.SQLiteRetrieverEngineType), nil
}

func createElasticsearchEngine(store types.VectorStore, cfg *config.Config) (interfaces.RetrieveEngineService, error) {
	cc := store.ConnectionConfig
	// Version-based v7/v8 SDK selection.
	// Version is auto-detected by PR2's TestConnection and saved to connection_config.
	// Empty version defaults to v8 (latest SDK).
	if isESv7(cc.Version) {
		return createElasticsearchV7Engine(store, cfg)
	}
	return createElasticsearchV8Engine(store, cfg)
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Set use_default_connection=true on the postgres vector store
  2. Implement custom-connection support if needed
  3. Reject the store config at the input boundary as well
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/container/engine_factory.go:166 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02). Data as JSON: /api/errors/0f263a11da306e86. Report an issue: GitHub.