{"record":{"id":"3578176ebdcea33b","repo":"vitessio/vitess","slug":"invalid-shard-path-v","errorCode":null,"errorMessage":"invalid shard path: %v","messagePattern":"invalid shard path: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/topoproto/shard.go","lineNumber":37,"sourceCode":"import (\n\t\"fmt\"\n\t\"strings\"\n)\n\n// KeyspaceShardString returns a \"keyspace/shard\" string taking\n// keyspace and shard as separate inputs.\nfunc KeyspaceShardString(keyspace, shard string) string {\n\treturn keyspace + \"/\" + shard\n}\n\n// ParseKeyspaceShard parse a \"keyspace/shard\" or \"keyspace:shard\"\n// string and extract both keyspace and shard\nfunc ParseKeyspaceShard(param string) (string, string, error) {\n\tkeySpaceShard := strings.Split(param, \"/\")\n\tif len(keySpaceShard) != 2 {\n\t\tkeySpaceShard = strings.Split(param, \":\")\n\t\tif len(keySpaceShard) != 2 {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"invalid shard path: %v\", param)\n\t\t}\n\t}\n\treturn keySpaceShard[0], keySpaceShard[1], nil\n}\n","sourceCodeStart":19,"sourceCodeEnd":42,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/topoproto/shard.go#L19-L42","documentation":"ParseKeyspaceShard expects a 'keyspace/shard' identifier separated by '/' (or the legacy ':'). The input string split into the wrong number of parts — either no separator or more than one — so no keyspace/shard pair could be extracted.","triggerScenarios":"Passing a bare shard name, an empty string, a keyspace without shard ('commerce'), or a malformed identifier ('commerce/0/extra') to ParseKeyspaceShard via commands like BackupShard, GetBackups, EmergencyReparentShard, RemoveBackup, or ParseKeyspaceShards.","commonSituations":"Shell quoting stripping the '/' or passing just the shard; using '-' as separator; passing tablet alias 'zone1-100' instead of keyspace/shard; extra slashes in scripted commands.","solutions":["Format the argument as keyspace/shard, e.g. commerce/0 or legacy commerce:0","Check shell quoting/escaping if the separator was lost","Verify you are not passing a tablet alias or keyspace-only string where keyspace/shard is required"],"exampleFix":"// before\nvtctldclient EmergencyReparentShard commerce\n// after\nvtctldclient EmergencyReparentShard commerce/0","handlingStrategy":"validation","validationCode":"parts := strings.Split(arg, \"/\")\nif len(parts) != 2 {\n    return fmt.Errorf(\"expected keyspace/shard, got %q\", arg)\n}","typeGuard":"func isKeyspaceShardFormat(s string) bool {\n    parts := strings.Split(s, \"/\")\n    return len(parts) == 2 && parts[0] != \"\" && parts[1] != \"\"\n}","tryCatchPattern":"ks, shard, err := topoproto.ParseKeyspaceShard(arg)\nif err != nil {\n    return fmt.Errorf(\"--%s must be keyspace/shard (e.g. commerce/0): %w\", flagName, err)\n}","preventionTips":["Always quote keyspace/shard args in shell","Use cell-uid aliases only where tablet aliases are expected, not keyspace/shard","Normalize legacy 'keyspace:shard' to 'keyspace/shard' in scripts"],"tags":["topo","shard","cli-validation"],"backgroundTag":"invalid-keyspace-shard-format","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}