{"record":{"id":"6c4e420359ee7627","repo":"vitessio/vitess","slug":"savevschema-v-w","errorCode":null,"errorMessage":"SaveVSchema(%v) = %w","messagePattern":"SaveVSchema\\((.+?)\\) = %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/grpcvtctldserver/server.go","lineNumber":1010,"sourceCode":"\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\t// We don't want to clone the base keyspace's key version\n\t\t// so we do NOT call bksvs.CloneVT() here. We instead only\n\t\t// clone the vschemapb.Keyspace field for the new snapshot\n\t\t// keyspace.\n\t\tsksvs := &topo.KeyspaceVSchemaInfo{\n\t\t\tName:     req.Name,\n\t\t\tKeyspace: bksvs.Keyspace.CloneVT(),\n\t\t}\n\t\t// SNAPSHOT keyspaces are excluded from global routing.\n\t\tsksvs.RequireExplicitRouting = true\n\n\t\tif err = s.ts.SaveVSchema(ctx, sksvs); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"SaveVSchema(%v) = %w\", sksvs, err)\n\t\t}\n\t}\n\n\tcells := []string{}\n\terr = s.ts.RebuildSrvVSchema(ctx, cells)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"RebuildSrvVSchema(%v) = %w\", cells, err)\n\t}\n\n\treturn &vtctldatapb.CreateKeyspaceResponse{\n\t\tKeyspace: &vtctldatapb.Keyspace{\n\t\t\tName:     req.Name,\n\t\t\tKeyspace: ki,\n\t\t},\n\t}, nil\n}\n\n// CreateShard is part of the vtctlservicepb.VtctldServer interface.","sourceCodeStart":992,"sourceCodeEnd":1028,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/grpcvtctldserver/server.go#L992-L1028","documentation":"When creating a SNAPSHOT keyspace, the server saves a synthetic serving VSchema (with RequireExplicitRouting so it is excluded from global routing) to the topo. If SaveVSchema fails (topo backend error), the error is wrapped as SaveVSchema(%v) = %w and CreateKeyspace aborts.","triggerScenarios":"Creating a SNAPSHOT keyspace when the underlying topo write fails: topo server unavailable, permission denied, keyspace record conflict, or connection timeouts to etcd/ZooKeeper.","commonSituations":"etcd/ZK outage or saturation during keyspace creation; read-only topo credentials; network partition between vtctld and topo server.","solutions":["Check the wrapped cause (%w) for the actual topo error and fix connectivity/permissions","Verify the topo server is healthy and writable by vtctld","Retry CreateKeyspace after the transient topo issue is resolved","Confirm a partially-created keyspace is cleaned up before retrying"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if err := ts.Health(ctx); err != nil {\n    return fmt.Errorf(\"topo unavailable, defer keyspace creation: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"_, err := client.CreateKeyspace(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"SaveVSchema\") {\n    // check topo connectivity/permissions, then retry\n}","preventionTips":["Verify topo server reachability before topo-mutating operations","Grant vtctld write permissions on the topo paths","Watch for topo backend (etcd/ZK) saturation during bulk operations","Clean up partially created keyspaces before retrying"],"tags":["vitess","topology","vschema","keyspace"],"backgroundTag":"topo-write-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}