{"record":{"id":"e0bf8b895773ffc9","repo":"vitessio/vitess","slug":"no-source-shards-specified-for-workflow-s","errorCode":null,"errorMessage":"no source shards specified for workflow %s ","messagePattern":"no source shards specified for workflow (.+?) ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/materializer.go","lineNumber":517,"sourceCode":"\t\t}\n\t}\n\tisPartial := false\n\tsourceShards, err := mz.sourceTs.GetServingShards(ctx, ms.SourceKeyspace)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(ms.SourceShards) > 0 {\n\t\tisPartial = true\n\t\tvar sourceShards2 []*topo.ShardInfo\n\t\tfor _, shard := range sourceShards {\n\t\t\tif slices.Contains(ms.SourceShards, shard.ShardName()) {\n\t\t\t\tsourceShards2 = append(sourceShards2, shard)\n\t\t\t}\n\t\t}\n\t\tsourceShards = sourceShards2\n\t}\n\tif len(sourceShards) == 0 {\n\t\treturn fmt.Errorf(\"no source shards specified for workflow %s \", ms.Workflow)\n\t}\n\n\ttargetShards, err := mz.ts.GetServingShards(ctx, ms.TargetKeyspace)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// For a multi-tenant migration, user can specify a subset of target shards to stream to, based\n\t// on the vindex they have chosen. This is to optimize the number of streams: for example, if we\n\t// have 256 shards and a tenant maps to a single shard we can avoid creating 255 unnecessary streams\n\t// that would be filtered out by the vindex anyway.\n\tvar specifiedTargetShards []string\n\tswitch {\n\tcase mz.IsMultiTenantMigration():\n\t\tspecifiedTargetShards = ms.WorkflowOptions.Shards\n\tcase len(ms.SourceShards) > 0: // shard-by-shard migration\n\t\tspecifiedTargetShards = ms.SourceShards\n\t}","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/materializer.go#L499-L535","documentation":"buildMaterializer requires at least one source shard to stream from. After applying any shard filter (ms.SourceShards), if the resulting list is empty, the workflow cannot be built, so this error is returned. It prevents creating a vreplication stream with no source.","triggerScenarios":"createWorkflowStreams or WorkflowAddTables builds a materializer where ms.SourceShards was specified but matched no shards, or the computed source shard list ends up empty after filtering.","commonSituations":"--source-shards flag with an invalid shard name that matches nothing; empty shard set on the source keyspace; shard names not matching topo naming convention (e.g. '-' vs '/'); source keyspace typo.","solutions":["Check shard names with `vtctl GetShardNames <keyspace>` and fix the source shard specification","Omit the source-shards filter to use all shards of the source keyspace","Verify the source keyspace name is correct and has serving shards"],"exampleFix":"// before\nCreateWorkflow --source-keyspace=commerce --source-shards=bad-shard\n// after\nCreateWorkflow --source-keyspace=commerce --source-shards=0-�00000000","handlingStrategy":"validation","validationCode":"shards, err := ts.GetShardNames(ctx, sourceKeyspace)\nif err != nil { return err }\nfor _, s := range requestedSourceShards {\n    if !slices.Contains(shards, s) {\n        return fmt.Errorf(\"source shard %q not in keyspace %s\", s, sourceKeyspace)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := createWorkflow(ctx, req); err != nil {\n    if strings.Contains(err.Error(), \"no source shards specified\") {\n        // fix --source-shards using GetShardNames output\n    }\n    return err\n}","preventionTips":["Fetch shard names via GetShardNames instead of hardcoding them","Use the standard '0-' or range formats produced by the topo","Omit source-shards filters when you want all shards"],"tags":["vitess","workflow","resharding","shards","configuration"],"backgroundTag":"no-source-shards","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}