{"record":{"id":"fbb95f1dcbdf3773","repo":"vitessio/vitess","slug":"error-creating-vtctldclient-w","errorCode":null,"errorMessage":"error creating vtctldclient: %w","messagePattern":"error creating vtctldclient: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"go/vt/vtadmin/cluster/cluster.go","lineNumber":147,"sourceCode":"\tvtctldargs := buildPFlagSlice(cfg.VtctldFlags)\n\n\tvtctldCfg, err := vtctldclient.Parse(protocluster, disco, vtctldargs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating vtctldclient proxy config: %w\", err)\n\t}\n\n\tfor _, opt := range cfg.vtctldConfigOpts {\n\t\tvtctldCfg = opt(vtctldCfg)\n\t}\n\n\tcluster.DB, err = vtsql.New(ctx, vtsqlCfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating vtsql proxy: %w\", err)\n\t}\n\n\tcluster.Vtctld, err = vtctldclient.New(ctx, vtctldCfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating vtctldclient: %w\", err)\n\t}\n\n\tif cfg.TabletFQDNTmplStr != \"\" {\n\t\tcluster.TabletFQDNTmpl, err = template.New(cluster.ID + \"-tablet-fqdn\").Parse(cfg.TabletFQDNTmplStr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse tablet fqdn template %s: %w\", cfg.TabletFQDNTmplStr, err)\n\t\t}\n\t}\n\n\tcluster.backupReadPool = cfg.BackupReadPoolConfig.NewReadPool()\n\tcluster.schemaReadPool = cfg.SchemaReadPoolConfig.NewReadPool()\n\tcluster.topoRWPool = cfg.TopoRWPoolConfig.NewRWPool()\n\tcluster.topoReadPool = cfg.TopoReadPoolConfig.NewReadPool()\n\tcluster.workflowReadPool = cfg.WorkflowReadPoolConfig.NewReadPool()\n\n\tcluster.emergencyFailoverPool = cfg.EmergencyFailoverPoolConfig.NewRWPool()\n\tcluster.failoverPool = cfg.FailoverPoolConfig.NewRWPool()\n","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/cluster/cluster.go#L129-L165","documentation":"cluster.New fails when vtctldclient.New cannot create the vtctld client proxy for the cluster, after the vtsql proxy was created successfully. The wrapped error is the underlying client construction failure, typically connection setup to the vtctld server.","triggerScenarios":"vtctldclient.New(ctx, vtctldCfg) errors during cluster.BuildCluster — vtctld unreachable, TLS/cert problems, or invalid resolved connection config.","commonSituations":"vtctld down or wrong host/port in flags; mTLS cert/key mismatch; network policy blocking vtadmin->vtctld.","solutions":["Verify the vtctld server is running and reachable at the configured address","Check TLS configuration (certs, CA) for the vtctldclient","Correct the vtctld flags and restart vtadmin"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before starting vtadmin, verify vtctld reachability\nhost, port := vtctldAddrFromFlags(cfg.VtctldFlags)\nconn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(host, port), 3*time.Second)\nif err != nil {\n    return fmt.Errorf(\"vtctld %s:%s unreachable: %w\", host, port, err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"c, err := cluster.BuildCluster(ctx, cfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"error creating vtctldclient\") {\n        return fmt.Errorf(\"cannot reach vtctld for cluster %q: %w\", cfg.ID, err)\n    }\n    return err\n}","preventionTips":["Monitor vtctld process health in every cell/cluster","Keep vtctldclient TLS config in sync with vtctld server certs","Verify ports in firewalls/security groups between vtadmin and vtctld"],"tags":["startup","vtctld","connection"],"backgroundTag":"connection-refused","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}