vitessio/vitess · error

no source shards specified for workflow %s

Error message

no source shards specified for workflow %s 

What it means

Returned by the materializer when creating a workflow with no source shards specified; the workflow's source keyspace must resolve to at least one shard.

Source

Thrown at go/vt/wrangler/materializer.go:1085

		}
	}
	isPartial := false
	sourceShards, err := wr.sourceTs.GetServingShards(ctx, ms.SourceKeyspace)
	if err != nil {
		return nil, err
	}
	if len(ms.SourceShards) > 0 {
		isPartial = true
		var sourceShards2 []*topo.ShardInfo
		for _, shard := range sourceShards {
			if slices.Contains(ms.SourceShards, shard.ShardName()) {
				sourceShards2 = append(sourceShards2, shard)
			}
		}
		sourceShards = sourceShards2
	}
	if len(sourceShards) == 0 {
		return nil, fmt.Errorf("no source shards specified for workflow %s ", ms.Workflow)
	}

	targetShards, err := wr.ts.GetServingShards(ctx, ms.TargetKeyspace)
	if err != nil {
		return nil, err
	}
	if len(ms.SourceShards) > 0 {
		var targetShards2 []*topo.ShardInfo
		for _, shard := range targetShards {
			if slices.Contains(ms.SourceShards, shard.ShardName()) {
				targetShards2 = append(targetShards2, shard)
			}
		}
		targetShards = targetShards2
	}
	if len(targetShards) == 0 {
		return nil, fmt.Errorf("no target shards specified for workflow %s ", ms.Workflow)
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify the source keyspace has serving shards (vtctldclient GetTablets / ListShards).
  2. Correct the shard names passed via SourceShards, or omit the option to use all shards.
  3. Check that the source keyspace name is correct so the topo returns its shards.

Example fix

// before
--source-shards "-8o"   // typo
// after
--source-shards "-80"
Defensive patterns

Strategy: validation

Validate before calling

shards, _ := wr.ts.GetShardNames(ctx, sourceKeyspace)
for _, want := range requestedSourceShards {
  if !slices.Contains(shards, want) {
    return fmt.Errorf("source shard %s not found in %s", want, sourceKeyspace)
  }
}

Prevention

When it happens

Trigger: prepareMaterializerStreams with ms.SourceShards yielding zero shards — e.g. SourceShards specified names that match no actual shards, or a keyspace with no serving shards returned by the source topo.

Common situations: Typo in --source-shards values (e.g. '-' vs '-80'); running against an empty/uninitialized source keyspace; all source shards filtered out by the shard-selection logic.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/a7101e2fa19d1bea. Report an issue: GitHub.