Tencent/WeKnora · error

doris connection requires addr (host:port)

Error message

doris connection requires addr (host:port)

What it means

A guard error from createDorisEngine: the Apache Doris connection requires ConnectionConfig.Addr to carry the FE MySQL-protocol endpoint in host:port form (default FE query port 9030). When Addr is empty the engine cannot build the MySQL DSN, so it fails fast with this message.

Source

Thrown at internal/container/engine_factory.go:333

	client, err := weaviate.NewClient(weaviateCfg)
	if err != nil {
		return nil, fmt.Errorf("create weaviate client: %w", err)
	}
	repo := weaviateRepo.NewWeaviateRetrieveEngineRepository(client, &store.IndexConfig)
	return retriever.NewKVHybridRetrieveEngine(repo, types.WeaviateRetrieverEngineType), nil
}

// createDorisEngine 创建 Apache Doris 检索引擎服务。
//
// Doris 同时使用两个端口:
//   - MySQL 协议(默认 9030)走 database/sql 做主链路读写;
//   - HTTP(默认 FE 8030)走 Stream Load 做 partial update。
//
// Addr 字段承担 host:9030 的 MySQL 端点;HTTPPort + Addr 的 host 部分组成 HTTP base URL。
func createDorisEngine(store types.VectorStore) (interfaces.RetrieveEngineService, error) {
	cc := store.ConnectionConfig
	if cc.Addr == "" {
		return nil, fmt.Errorf("doris connection requires addr (host:port)")
	}
	if cc.Database == "" {
		return nil, fmt.Errorf("doris connection requires database")
	}

	mc := mysql.NewConfig()
	mc.User = cc.Username
	mc.Passwd = cc.Password
	utils.RegisterMySQLSSRFDialer()
	mc.Net = utils.MySQLSSRFNetwork
	mc.Addr = cc.Addr
	mc.DBName = cc.Database
	mc.Params = map[string]string{"charset": "utf8mb4"}
	mc.ParseTime = true
	mc.Loc = time.Local
	db, err := sql.Open("mysql", mc.FormatDSN())
	if err != nil {
		return nil, fmt.Errorf("create doris client: %w", err)

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Set ConnectionConfig.Addr to "<fe-host>:9030" (the Doris FE MySQL query port)
  2. Load the value from a correct env var and fail fast at startup if empty
  3. Do not confuse Addr with the HTTP Stream Load endpoint (HTTPPort 8030); both are needed
  4. Add a config lint/test that asserts Addr is non-empty for Doris stores

Example fix

// before
cc := types.ConnectionConfig{HTTPPort: 8030, Database: "doris_db"}
// after
cc := types.ConnectionConfig{Addr: "fe.example.com:9030", HTTPPort: 8030, Database: "doris_db"}
Defensive patterns

Strategy: validation

Validate before calling

func validateDorisConfig(cc types.ConnectionConfig) error {
    if cc.Addr == "" { return errors.New("doris addr (host:port) required, e.g. fe:9030") }
    if _, _, err := net.SplitHostPort(cc.Addr); err != nil { return fmt.Errorf("doris addr must be host:port: %w", err) }
    return nil
}

Type guard

func dorisAddrSet(cc types.ConnectionConfig) bool { _, _, err := net.SplitHostPort(cc.Addr); return cc.Addr != "" && err == nil }

Try / catch

engine, err := createEngineServiceFromStore(ctx, store)
if err != nil && strings.Contains(err.Error(), "requires addr") {
    return fmt.Errorf("set Doris FE MySQL endpoint as ConnectionConfig.Addr (host:9030): %w", err)
}

Prevention

When it happens

Trigger: Configuring a Doris vector store without setting cc.Addr — e.g. only HTTPPort or Database provided — then creating the engine via createEngineServiceFromStore.

Common situations: Users copying a MySQL/other store config that uses separate host+port fields instead of Addr; empty DORIS_ADDR env var; assuming the HTTP port (8030) config alone is sufficient.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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