vitessio/vitess · critical

error creating discovery impl (%s): %w

Error message

error creating discovery impl (%s): %w

What it means

cluster.New fails while instantiating the configured discovery implementation via discovery.New(cfg.DiscoveryImpl, ...). Wrapping preserves the underlying cause, which is typically an unknown impl name or bad discovery flags. This happens during vtadmin startup while building each configured cluster, called from cluster.BuildCluster.

Source

Thrown at go/vt/vtadmin/cluster/cluster.go:111

	//  the interim, we won't pick that up until something refreshes the cache.
	schemaCache *cache.Cache[schemacache.Key, []*vtadminpb.Schema]

	cfg Config
}

// New creates a new Cluster from a Config.
func New(ctx context.Context, cfg Config) (*Cluster, error) {
	cluster := &Cluster{
		ID:   cfg.ID,
		Name: cfg.Name,
		cfg:  cfg,
	}

	discoargs := buildPFlagSlice(cfg.DiscoveryFlagsByImpl[cfg.DiscoveryImpl])

	disco, err := discovery.New(cfg.DiscoveryImpl, cluster.ToProto(), discoargs)
	if err != nil {
		return nil, fmt.Errorf("error creating discovery impl (%s): %w", cfg.DiscoveryImpl, err)
	}

	cluster.Discovery = disco

	protocluster := cluster.ToProto()

	vtsqlargs := buildPFlagSlice(cfg.VtSQLFlags)

	vtsqlCfg, err := vtsql.Parse(protocluster, disco, vtsqlargs)
	if err != nil {
		return nil, fmt.Errorf("error creating vtsql connection config: %w", err)
	}

	for _, opt := range cfg.vtsqlConfigOpts {
		vtsqlCfg = opt(vtsqlCfg)
	}

	vtctldargs := buildPFlagSlice(cfg.VtctldFlags)

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Set discovery-impl to a supported value (e.g. etcd2/zk2 depending on registration) in the vtadmin cluster config
  2. Provide the required discovery flags for that impl (topo server addresses, root path)
  3. Check discovery.New registration list for valid impl names on your vitess version

Example fix

// before
discovery-impl: "etcd"
// after
discovery-impl: "etcd2"
topo-server: "http://etcd:2379"
topo-root: "/vitess/global"
Defensive patterns

Strategy: validation

Validate before calling

// before starting vtadmin
allowed := map[string]bool{"etcd2": true, "zk2": true, "consul": true}
if !allowed[cfg.DiscoveryImpl] {
    return fmt.Errorf("unsupported discovery-impl %q; want one of etcd2|zk2|consul", cfg.DiscoveryImpl)
}

Try / catch

c, err := cluster.BuildCluster(ctx, cfg)
if err != nil {
    if strings.Contains(err.Error(), "error creating discovery impl") {
        return fmt.Errorf("fix discovery-impl/flags in cluster %q config: %w", cfg.ID, err)
    }
    return err
}

Prevention

When it happens

Trigger: Config has discovery-impl set to an unregistered impl name, or the flags passed to the impl (buildPFlagSlice of cfg.DiscoveryFlagsByImpl) fail that impl's flag validation/parsing.

Common situations: Typo like discovery-impl=etcd2 when only 'etcd' is registered; missing required flags (e.g. topo server address) for the chosen impl; deprecated impl name after a vitess upgrade.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/8e243c6280d8dc95. Report an issue: GitHub.