{"record":{"id":"d18bcabd562b19dd","repo":"vitessio/vitess","slug":"no-target-shards-specified-for-workflow-s-d18bca","errorCode":null,"errorMessage":"no target shards specified for workflow %s ","messagePattern":"no target shards specified for workflow (.+?) ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":1102,"sourceCode":"\tif len(sourceShards) == 0 {\n\t\treturn nil, fmt.Errorf(\"no source shards specified for workflow %s \", ms.Workflow)\n\t}\n\n\ttargetShards, err := wr.ts.GetServingShards(ctx, ms.TargetKeyspace)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(ms.SourceShards) > 0 {\n\t\tvar targetShards2 []*topo.ShardInfo\n\t\tfor _, shard := range targetShards {\n\t\t\tif slices.Contains(ms.SourceShards, shard.ShardName()) {\n\t\t\t\ttargetShards2 = append(targetShards2, shard)\n\t\t\t}\n\t\t}\n\t\ttargetShards = targetShards2\n\t}\n\tif len(targetShards) == 0 {\n\t\treturn nil, fmt.Errorf(\"no target shards specified for workflow %s \", ms.Workflow)\n\t}\n\n\tsourceTs := wr.ts\n\tif ms.ExternalCluster != \"\" { // when the source is an external mysql cluster mounted using the Mount command\n\t\texternalTopo, err := wr.ts.OpenExternalVitessClusterServer(ctx, ms.ExternalCluster)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to open external topo: %v\", err)\n\t\t}\n\t\tsourceTs = externalTopo\n\t}\n\tdifferentPVs := false\n\tsourceVSchema, err := sourceTs.GetVSchema(ctx, ms.SourceKeyspace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get source keyspace vschema: %v\", err)\n\t}\n\tdifferentPVs = primaryVindexesDiffer(ms, sourceVSchema.Keyspace, vschema.Keyspace)\n\n\treturn &materializer{","sourceCodeStart":1084,"sourceCodeEnd":1120,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L1084-L1120","documentation":"Returned by the materializer when creating a workflow with no target shards specified; the workflow's target keyspace must resolve to at least one shard.","triggerScenarios":"prepareMaterializerStreams with ms.TargetShards yielding zero shards — specified shard names matching nothing in the target keyspace, or the target keyspace has no serving shards.","commonSituations":"Reshard/MoveTables invoked before the target keyspace was created or its shards added; misspelled shard names in --target-shards; wrong target keyspace name.","solutions":["Ensure the target keyspace exists and its shards are created and serving (ListShards on the target).","Fix the TargetShards names or omit the option to use all target shards.","Verify the target keyspace name is correct."],"exampleFix":"// before: target keyspace not yet created\nvtctldclient Reshard --sourceks commerce ... --targetks custoemr\n// after: create keyspace/shards first, then Reshard with correct keyspace","handlingStrategy":"validation","validationCode":"shards, _ := wr.ts.GetShardNames(ctx, targetKeyspace)\nif len(shards) == 0 {\n  return fmt.Errorf(\"target keyspace %s has no shards\", targetKeyspace)\n}\nfor _, want := range requestedTargetShards {\n  if !slices.Contains(shards, want) {\n    return fmt.Errorf(\"target shard %s not found\", want)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create the target keyspace and shards before running Reshard/MoveTables.","Verify target shard names via ListShards.","Validate keyspace names in deployment scripts."],"tags":["sharding","materializer","configuration"],"backgroundTag":"no-target-shards","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}