{"record":{"id":"252973461eb8ad82","repo":"vitessio/vitess","slug":"failed-to-parse-tablet-fqdn-template-s-w","errorCode":null,"errorMessage":"failed to parse tablet fqdn template %s: %w","messagePattern":"failed to parse tablet fqdn template (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"go/vt/vtadmin/cluster/cluster.go","lineNumber":153,"sourceCode":"\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\n\tif cluster.cfg.SchemaCacheConfig == nil {\n\t\tcluster.cfg.SchemaCacheConfig = &cache.Config{}\n\t}\n\tcluster.schemaCache = cache.New(func(ctx context.Context, key schemacache.Key) ([]*vtadminpb.Schema, error) {\n\t\t// TODO: make a private method to separate the fetching bits from the cache bits\n\t\tif key.Keyspace == \"\" {","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/cluster/cluster.go#L135-L171","documentation":"cluster.New fails when the optional --tablet-fqdn-template value cannot be parsed as a Go text/template for the cluster. This is a pure config-syntax error: the template string (e.g. used to render tablet FQDNs) is invalid template syntax or references bad actions.","triggerScenarios":"cfg.TabletFQDNTmplStr is non-empty and template.New(...).Parse fails — e.g. unbalanced {{ }}, unknown template functions.","commonSituations":"Typo in the template such as '{{.Alias}}' vs '{{ .Alias }}' mistakes like '{{.Alias'; copy-paste artifacts; using unsupported fields/functions.","solutions":["Fix the template syntax in --tablet-fqdn-template (valid Go text/template, e.g. '{{.Tablet.Alias}}.{{.Cell}}.example.com')","Validate the template with a small Go snippet or text/template playground before deploying","Remove the flag if templating is not needed"],"exampleFix":"// before\n--tablet-fqdn-template '{{.Alias' \n// after\n--tablet-fqdn-template '{{.Tablet.Alias}}.{{.Cell}}.ks.example.com'","handlingStrategy":"validation","validationCode":"// validate template before passing to config\nif cfg.TabletFQDNTmplStr != \"\" {\n    if _, err := texttemplate.New(\"check\").Parse(cfg.TabletFQDNTmplStr); err != nil {\n        return fmt.Errorf(\"invalid --tablet-fqdn-template: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"c, err := cluster.BuildCluster(ctx, cfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"tablet fqdn template\") {\n        return fmt.Errorf(\"bad --tablet-fqdn-template %q: %w\", cfg.TabletFQDNTmplStr, err)\n    }\n    return err\n}","preventionTips":["Lint templates in CI with text/template before deploy","Keep a known-good template snippet in deployment docs","Test rendering the template against a sample tablet struct"],"tags":["startup","configuration","template-parsing"],"backgroundTag":"invalid-template-syntax","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}