Tencent/WeKnora · error
create milvus client: %w
Error message
create milvus client: %w
What it means
This wraps an error from milvusclient.New when building the Milvus client in createMilvusEngine. The config is derived via buildMilvusClientConfig from ConnectionConfig; New connects/validates the endpoint, so failures include bad addresses, missing credentials, or unreachable servers depending on the client version's laziness.
Source
Thrown at internal/container/engine_factory.go:255
client, err := qdrant.NewClient(&qdrant.Config{
Host: cc.Host,
Port: port,
APIKey: cc.APIKey,
UseTLS: cc.UseTLS,
GrpcOptions: []grpc.DialOption{grpc.WithContextDialer(utils.SSRFSafeGRPCDialer)},
})
if err != nil {
return nil, fmt.Errorf("create qdrant client: %w", err)
}
repo := qdrantRepo.NewQdrantRetrieveEngineRepository(client, &store.IndexConfig)
return retriever.NewKVHybridRetrieveEngine(repo, types.QdrantRetrieverEngineType), nil
}
func createMilvusEngine(ctx context.Context, store types.VectorStore) (interfaces.RetrieveEngineService, error) {
milvusCfg := buildMilvusClientConfig(store.ConnectionConfig)
client, err := milvusclient.New(ctx, &milvusCfg)
if err != nil {
return nil, fmt.Errorf("create milvus client: %w", err)
}
repo := milvusRepo.NewMilvusRetrieveEngineRepository(client, &store.IndexConfig)
return retriever.NewKVHybridRetrieveEngine(repo, types.MilvusRetrieverEngineType), nil
}
func buildMilvusClientConfig(cc types.ConnectionConfig) milvusclient.ClientConfig {
addr := cc.Addr
if addr == "" {
addr = "localhost:19530"
}
milvusCfg := milvusclient.ClientConfig{
Address: addr,
DialOptions: []grpc.DialOption{
grpc.WithTimeout(5 * time.Second),
grpc.WithContextDialer(utils.SSRFSafeGRPCDialer),
},
}View on GitHub (pinned to 988cbb0330)
Solutions
- Log the output of buildMilvusClientConfig (redacted) and verify Host/Port/URI fields
- Confirm the Milvus gRPC endpoint (default 19530) is reachable from the app's network
- Strip scheme from host:port style addresses unless the client config expects a URI
- Verify username/password or TLS settings match the deployed Milvus auth mode
Example fix
// before cc.Addr = "http://milvus:19530" // after cc.Addr = "milvus:19530"
Defensive patterns
Strategy: validation
Validate before calling
func validMilvusAddr(cc types.ConnectionConfig) bool {
return cc.Addr != "" && !strings.Contains(cc.Addr, " ")
}
// optionally probe: net.DialTimeout("tcp", cc.Addr, 3*time.Second) Type guard
func milvusReady(cc types.ConnectionConfig) bool { return cc.Addr != "" && net.ParseIP(strings.Split(cc.Addr, ":")[0]) != nil || strings.Contains(cc.Addr, ".") } Try / catch
engine, err := createMilvusEngine(ctx, store)
if err != nil {
if strings.Contains(err.Error(), "create milvus client") {
return fmt.Errorf("milvus client config bad (addr=%s redacted-creds): %w", store.ConnectionConfig.Addr, err)
}
return err
} Prevention
- Log buildMilvusClientConfig output (redacted) during startup to verify derived fields
- Confirm network path to Milvus gRPC port 19530 from the deployment environment
- Match TLS/auth settings to the Milvus deployment mode (standalone/cluster, auth on/off)
- Pin milvus-client-go version; constructor behavior changed across versions
When it happens
Trigger: createEngineServiceFromStore dispatching to a Milvus store where buildMilvusClientConfig produces an invalid endpoint (empty host, wrong port, bad URI scheme) or credentials/TLS settings rejected by milvusclient.New(ctx, &milvusCfg).
Common situations: Milvus running behind a proxy but configured with the internal gRPC port (19530) unreachable from the app; missing MILVUS_HOST env var; enabling TLS without a properly signed cert; using an address with http:// prefix where the client expects host:port.
Related errors
- create elasticsearch v7 client: %w
- create qdrant client: %w
- rerank call failed: %w
- failed to do bulk: %w
- failed to delete by query: %w
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/c46d3aa3d2c17459.
Report an issue: GitHub.