{"record":{"id":"59fef4a0063b9ef8","repo":"vitessio/vitess","slug":"failed-to-resolve-keyspace-shard-wildcard-v-v","errorCode":null,"errorMessage":"failed to resolve keyspace/shard wildcard %v: %v","messagePattern":"failed to resolve keyspace/shard wildcard (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":878,"sourceCode":"// */0                                // using plain matching\nfunc shardParamsToKeyspaceShards(ctx context.Context, wr *wrangler.Wrangler, params []string) ([]topo.KeyspaceShard, error) {\n\tresult := make([]topo.KeyspaceShard, 0, len(params))\n\tfor _, param := range params {\n\t\tif param[0] == '/' {\n\t\t\t// this is a topology-specific path\n\t\t\tfor _, path := range params {\n\t\t\t\tkeyspace, shard, err := topoproto.ParseKeyspaceShard(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tresult = append(result, topo.KeyspaceShard{Keyspace: keyspace, Shard: shard})\n\t\t\t}\n\t\t} else {\n\t\t\t// this is not a path, so assume a keyspace\n\t\t\t// name / shard name, each possibly with wildcards\n\t\t\tkeyspaceShards, err := wr.TopoServer().ResolveShardWildcard(ctx, param)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to resolve keyspace/shard wildcard %v: %v\", param, err)\n\t\t\t}\n\t\t\tresult = append(result, keyspaceShards...)\n\t\t}\n\t}\n\treturn result, nil\n}\n\n// tabletParamsToTabletAliases takes multiple params and converts them\n// to tablet aliases.\nfunc tabletParamsToTabletAliases(params []string) ([]*topodatapb.TabletAlias, error) {\n\tresult := make([]*topodatapb.TabletAlias, len(params))\n\tvar err error\n\tfor i, param := range params {\n\t\tresult[i], err = topoproto.ParseTabletAlias(param)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L860-L896","documentation":"shardParamsToKeyspaceShards expands keyspace/shard parameters that may contain wildcards (e.g. 'ks/-*') via topo.ResolveShardWildcard. This error wraps any failure from that resolution, such as no shards matching the wildcard pattern or topo server errors.","triggerScenarios":"Running a shard-scoped command like commandDeleteShard with a keyspace/shard argument (not a full path) whose wildcard resolves to nothing or fails in the topo server.","commonSituations":"Typo in shard name; wildcard matches no shards because the shard was already deleted or never existed; topo connectivity problems; confusing keyrange-style shard names.","solutions":["Check the wrapped cause and fix the keyspace/shard pattern","List shards first with `vtctl ListShards <keyspace>` and build the pattern from real shard names","Confirm topo server reachability before retrying","Use exact shard names instead of wildcards to avoid ambiguous globs"],"exampleFix":"// before\nvtctl DeleteShard 'commerce/-'\n// after\nvtctl ListShards commerce   # see actual shards, e.g. 0\necho vtctl DeleteShard 'commerce/0'\n","handlingStrategy":"validation","validationCode":"# Confirm shards exist before wildcarding\nvtctl ListShards commerce   # inspect shard names\n# then pass explicit keyspace/shard values\necho vtctl DeleteShard commerce/0","typeGuard":null,"tryCatchPattern":"if err := runVtctl(\"DeleteShard\", ksShard); err != nil {\n    if strings.Contains(err.Error(), \"failed to resolve keyspace/shard wildcard\") {\n        // log ksShard and the wrapped topo error; prompt for exact shard\n    }\n}","preventionTips":["List shards explicitly before destructive commands like DeleteShard","Prefer exact keyspace/shard arguments in automation","Verify shard naming conventions (keyranges) before building globs","Health-check the topo server before batch shard operations"],"tags":["vtctl","topo","shard","wildcard"],"backgroundTag":"shard-wildcard-resolution-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}