{"record":{"id":"ae3cefd3b1719968","repo":"vitessio/vitess","slug":"failed-updating-tablet-v-v","errorCode":null,"errorMessage":"failed updating tablet %v: %v","messagePattern":"failed updating tablet (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/tablet.go","lineNumber":647,"sourceCode":"\t\ttablet.PrimaryTermStartTime = protoutil.TimeToProto(time.Now())\n\t}\n\n\terr = ts.CreateTablet(ctx, tablet)\n\tif IsErrType(err, NodeExists) && allowUpdate {\n\t\t// Try to update then\n\t\toldTablet, err := ts.GetTablet(ctx, tablet.Alias)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed reading existing tablet %v: %v\", topoproto.TabletAliasString(tablet.Alias), err)\n\t\t}\n\n\t\t// Check we have the same keyspace / shard, and if not,\n\t\t// require the allowDifferentShard flag.\n\t\tif oldTablet.Keyspace != tablet.Keyspace || oldTablet.Shard != tablet.Shard {\n\t\t\treturn fmt.Errorf(\"old tablet has shard %v/%v. Cannot override with shard %v/%v. Delete and re-add tablet if you want to change the tablet's keyspace/shard\", oldTablet.Keyspace, oldTablet.Shard, tablet.Keyspace, tablet.Shard)\n\t\t}\n\t\toldTablet.Tablet = tablet.CloneVT()\n\t\tif err := ts.UpdateTablet(ctx, oldTablet); err != nil {\n\t\t\treturn fmt.Errorf(\"failed updating tablet %v: %v\", topoproto.TabletAliasString(tablet.Alias), err)\n\t\t}\n\t\treturn nil\n\t}\n\treturn err\n}\n\n// ParseServingTabletType parses the tablet type into the enum, and makes sure\n// that the enum is of serving type (PRIMARY, REPLICA, RDONLY/BATCH).\n//\n// Note: This function more closely belongs in topoproto, but that would create\n// a circular import between packages topo and topoproto.\nfunc ParseServingTabletType(param string) (topodatapb.TabletType, error) {\n\tservedType, err := topoproto.ParseTabletType(param)\n\tif err != nil {\n\t\treturn topodatapb.TabletType_UNKNOWN, err\n\t}\n\n\tif !IsInServingGraph(servedType) {","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/tablet.go#L629-L665","documentation":"InitTablet's update path validated the existing tablet (same keyspace/shard) and attempted ts.UpdateTablet with the new record, but the write to the topo server failed. The tablet stays registered with its old data — the update did not take effect.","triggerScenarios":"GetTablet succeeded, keyspace/shard matched, but UpdateTablet failed: topo server connection lost, version conflict (concurrent modification, e.g. tablethealthcheck updating the record), or write permission denied on the tablet node.","commonSituations":"Two vttablet processes with the same alias fighting over the topo record; zookeeper session expiring mid-operation; etcd/ratelimit or network partition during tablet startup.","solutions":["Retry InitTablet — version conflicts from concurrent writers are usually transient","Ensure only one vttablet process uses this alias (check for duplicates: vtctldclient GetTablets)","Check topo write permissions and connection stability","Update the topo server backing store if it is unhealthy (e.g. zookeeper quorum)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure topo write path is healthy\nif _, err := ts.GetTablet(ctx, alias); err != nil { return err } // readable and exists","typeGuard":null,"tryCatchPattern":"if err := ts.InitTablet(ctx, tablet, false, true, false); err != nil {\n    if strings.Contains(err.Error(), \"failed updating tablet\") {\n        // transient topo write failure; retry with backoff\n    }\n    return err\n}","preventionTips":["Avoid two vttablet processes with the same alias","Size zookeeper session timeouts above worst-case operation latency","Retry transient topo write failures with backoff","Check topo ACLs grant write on tablets/"],"tags":["topo","tablet-registration","concurrency"],"backgroundTag":"topo-write-conflict","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}