{"record":{"id":"a81471f3f4ebf979","repo":"vitessio/vitess","slug":"failed-to-parse-tablet-alias-s-w","errorCode":null,"errorMessage":"failed to parse tablet_alias %s: %w","messagePattern":"failed to parse tablet_alias (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtadmin/cluster/cluster.go","lineNumber":329,"sourceCode":"\n\ttablet := &vtadminpb.Tablet{\n\t\tCluster: &vtadminpb.Cluster{\n\t\t\tId:   c.ID,\n\t\t\tName: c.Name,\n\t\t},\n\t\tTablet: &topotablet,\n\t}\n\n\ttopotablet.Type, err = topoproto.ParseTabletType(tabletTypeStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttablet.State = vtadminproto.ParseTabletServingState(servingStateStr)\n\n\ttopotablet.Alias, err = topoproto.ParseTabletAlias(aliasStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse tablet_alias %s: %w\", aliasStr, err)\n\t}\n\n\tif topotablet.Alias.Cell != cell {\n\t\t// (TODO:@amason) ???\n\t\tlog.Warn(fmt.Sprintf(\"tablet cell %s does not match alias %s. ignoring for now\", cell, topoproto.TabletAliasString(topotablet.Alias)))\n\t}\n\n\tif mtstStr != \"\" {\n\t\ttimeTime, err := time.Parse(time.RFC3339, mtstStr)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed parsing primary_term_start_time %s: %w\", mtstStr, err)\n\t\t}\n\n\t\ttopotablet.PrimaryTermStartTime = protoutil.TimeToProto(timeTime)\n\t}\n\n\tif c.TabletFQDNTmpl != nil {\n\t\ttablet.FQDN, err = textutil.ExecuteTemplate(c.TabletFQDNTmpl, tablet)","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/cluster/cluster.go#L311-L347","documentation":"Thrown by parseTablet in the vtadmin cluster package when topoproto.ParseTabletAlias cannot parse the alias string associated with a tablet discovered in a cell. The alias string must have the canonical form \"<cell>-<uid>\" (e.g. \"zone1-100\"); anything malformed fails. The wrapped error from ParseTabletAlias gives the specific parsing cause.","triggerScenarios":"Calling cluster methods that discover tablets (via parseTablets, e.g. GetTablets) when the vtadmin tablet cache/etcd2 data contains an alias string that is not \"<cell>-<uid>\" — e.g. missing dash, non-numeric uid, or empty alias.","commonSituations":"Corrupted or hand-edited topo data; older topo records written by a different Vitess version with a different alias format; scripts that manually insert tablet records into the topo server; a cell name containing characters that break the alias format.","solutions":["Inspect the alias string in the error message and fix the tablet record in the topo server so it matches the \"<cell>-<uid>\" format (e.g. via vtctl DeleteTablet + re-init, or by correcting the record).","Run `vtctl GetTablets <cell>` to list aliases and find the malformed one before vtadmin reads it.","If the record is stale/orphaned, delete it: `vtctl DeleteTablet <bad-alias>`.","Verify all cells' topo data was written by the same Vitess version (no mixed-version topo corruption)."],"exampleFix":"// before (malformed alias in topo data)\nalias = \"zone1_100\" // underscore instead of dash\n// after\ntopotablet.Alias, err = topoproto.ParseTabletAlias(\"zone1-100\") // valid <cell>-<uid>","handlingStrategy":"validation","validationCode":"alias := \"zone1-100\"\nparts := strings.SplitN(alias, \"-\", 2)\nvalid := len(parts) == 2 && parts[0] != \"\" && func() bool {\n\t_, err := strconv.ParseUint(parts[1], 10, 32)\n\treturn err == nil\n}()\nif !valid {\n\treturn fmt.Errorf(\"malformed tablet alias %q, want <cell>-<uid>\", alias)\n}","typeGuard":"func isWellFormedTabletAlias(alias string) bool {\n\t_, err := topoproto.ParseTabletAlias(alias)\n\treturn err == nil\n}","tryCatchPattern":null,"preventionTips":["Never hand-edit topo records; use vtctl/vtctldclient commands that format aliases correctly.","Before bulk-loading tablet data, run every alias through topoproto.ParseTabletAlias as a preflight check.","Keep all Vitess components on compatible versions so alias serialization stays consistent."],"tags":["vtadmin","topo","tablet-alias","parsing"],"backgroundTag":"invalid-tablet-alias-format","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}