{"record":{"id":"8e243c6280d8dc95","repo":"vitessio/vitess","slug":"error-creating-discovery-impl-s-w","errorCode":null,"errorMessage":"error creating discovery impl (%s): %w","messagePattern":"error creating discovery impl \\((.+?)\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"go/vt/vtadmin/cluster/cluster.go","lineNumber":111,"sourceCode":"\t//  the interim, we won't pick that up until something refreshes the cache.\n\tschemaCache *cache.Cache[schemacache.Key, []*vtadminpb.Schema]\n\n\tcfg Config\n}\n\n// New creates a new Cluster from a Config.\nfunc New(ctx context.Context, cfg Config) (*Cluster, error) {\n\tcluster := &Cluster{\n\t\tID:   cfg.ID,\n\t\tName: cfg.Name,\n\t\tcfg:  cfg,\n\t}\n\n\tdiscoargs := buildPFlagSlice(cfg.DiscoveryFlagsByImpl[cfg.DiscoveryImpl])\n\n\tdisco, err := discovery.New(cfg.DiscoveryImpl, cluster.ToProto(), discoargs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating discovery impl (%s): %w\", cfg.DiscoveryImpl, err)\n\t}\n\n\tcluster.Discovery = disco\n\n\tprotocluster := cluster.ToProto()\n\n\tvtsqlargs := buildPFlagSlice(cfg.VtSQLFlags)\n\n\tvtsqlCfg, err := vtsql.Parse(protocluster, disco, vtsqlargs)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating vtsql connection config: %w\", err)\n\t}\n\n\tfor _, opt := range cfg.vtsqlConfigOpts {\n\t\tvtsqlCfg = opt(vtsqlCfg)\n\t}\n\n\tvtctldargs := buildPFlagSlice(cfg.VtctldFlags)","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/cluster/cluster.go#L93-L129","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set discovery-impl to a supported value (e.g. etcd2/zk2 depending on registration) in the vtadmin cluster config","Provide the required discovery flags for that impl (topo server addresses, root path)","Check discovery.New registration list for valid impl names on your vitess version"],"exampleFix":"// before\ndiscovery-impl: \"etcd\"\n// after\ndiscovery-impl: \"etcd2\"\ntopo-server: \"http://etcd:2379\"\ntopo-root: \"/vitess/global\"","handlingStrategy":"validation","validationCode":"// before starting vtadmin\nallowed := map[string]bool{\"etcd2\": true, \"zk2\": true, \"consul\": true}\nif !allowed[cfg.DiscoveryImpl] {\n    return fmt.Errorf(\"unsupported discovery-impl %q; want one of etcd2|zk2|consul\", cfg.DiscoveryImpl)\n}","typeGuard":null,"tryCatchPattern":"c, err := cluster.BuildCluster(ctx, cfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"error creating discovery impl\") {\n        return fmt.Errorf(\"fix discovery-impl/flags in cluster %q config: %w\", cfg.ID, err)\n    }\n    return err\n}","preventionTips":["Validate the full cluster config with a startup dry-run in CI","Keep discovery impl names in sync with your vitess version's registry","Document required discovery flags per impl in deployment templates"],"tags":["startup","discovery","configuration"],"backgroundTag":"unknown-discovery-impl","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}