Tencent/WeKnora · error

create tencent vectordb client: %w

Error message

create tencent vectordb client: %w

What it means

This wraps an error from the Tencent VectorDB Go SDK client constructor in createTencentVectorDBEngine. The client is built with credentials, timeout, and an SSRF-validating transport; construction errors indicate invalid credentials/endpoint configuration or SDK-level setup failure before any request is issued.

Source

Thrown at internal/container/engine_factory.go:387

// hostFromAddr 从 "host:port" 中拆出 host 部分;Addr 没有冒号时整段当作 host。
func hostFromAddr(addr string) string {
	if i := strings.LastIndex(addr, ":"); i > 0 {
		return addr[:i]
	}
	return addr
}

func createTencentVectorDBEngine(store types.VectorStore) (interfaces.RetrieveEngineService, error) {
	cc := store.ConnectionConfig
	client, err := tcvectordb.NewRpcClient(cc.Addr, cc.Username, cc.APIKey, &tcvectordb.ClientOption{
		ReadConsistency: tcvectordb.EventualConsistency,
		Timeout:         10 * time.Second,
		Transport: &utils.SSRFValidatingRoundTripper{
			Base: utils.NewSSRFSafeTransport(utils.DefaultSSRFSafeHTTPClientConfig()),
		},
	})
	if err != nil {
		return nil, fmt.Errorf("create tencent vectordb client: %w", err)
	}
	repo := tencentVectorDBRepo.NewTencentVectorDBRetrieveEngineRepository(client, cc.Database, &store.IndexConfig)
	return retriever.NewKVHybridRetrieveEngine(repo, types.TencentVectorDBRetrieverEngineType), nil
}

View on GitHub (pinned to 988cbb0330)

Solutions

  1. Verify cc.Username and cc.APIKey are both set and free of whitespace/quotes
  2. Confirm the endpoint URL points at the correct Tencent Cloud region vectorDB endpoint
  3. Check the SDK version's client option struct matches the fields being set here
  4. Enable SDK debug logging to see the precise constructor error wrapped by this message

Example fix

// before
cc := types.ConnectionConfig{Username: "", APIKey: os.Getenv("VDB_KEY")} // VDB_KEY unset
// after
cc := types.ConnectionConfig{Username: "root", APIKey: mustEnv("TENCENT_VECTORDB_KEY")}
Defensive patterns

Strategy: validation

Validate before calling

func validTencentVDBConfig(cc types.ConnectionConfig) error {
    if cc.Username == "" { return errors.New("tencent vectordb username required") }
    if cc.APIKey == "" { return errors.New("tencent vectordb api key required") }
    u, err := url.Parse(cc.Addr)
    if err != nil || u.Host == "" { return fmt.Errorf("tencent vectordb endpoint invalid: %q", cc.Addr) }
    return nil
}

Type guard

func tencentVDBReady(cc types.ConnectionConfig) bool { return cc.Username != "" && cc.APIKey != "" && cc.Addr != "" }

Try / catch

engine, err := createEngineServiceFromStore(ctx, store)
if err != nil && strings.Contains(err.Error(), "create tencent vectordb client") {
    return fmt.Errorf("tencent vectordb config invalid: check username/apikey/endpoint: %w", err)
}

Prevention

When it happens

Trigger: createEngineServiceFromStore dispatching to a Tencent VectorDB store with a missing/invalid Username/APIKey, bad endpoint host, or SDK constructor rejecting the supplied options (e.g. incompatible transport or timeout configuration).

Common situations: Empty TENCENT_VECTORDB_USERNAME/KEY env vars; wrong region endpoint URL; SDK version upgrade changing the client option struct; account lacks vectordb enablement so the SDK rejects the config.

Related errors


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