vitessio/vitess · error · ErrNoStreams

no streams found

Error message

no streams found

What it means

ErrNoStreams is raised when the traffic switcher finds no vreplication streams for a workflow in the target keyspace. Without target streams there is nothing to switch traffic for or build targets from, so BuildTargets, LegacyBuildTargets and getWorkflowState fail fast with this sentinel.

Source

Thrown at go/vt/vtctl/workflow/traffic_switcher.go:121

// TrafficSwitchDirection specifies the switching direction.
type TrafficSwitchDirection int

func (tsd TrafficSwitchDirection) String() string {
	if tsd == DirectionForward {
		return "forward"
	}
	return "backward"
}

// TableRemovalType specifies the way the a table will be removed during a
// DropSource for a MoveTables workflow.
type TableRemovalType int

var (
	// ErrNoStreams occurs when no target streams are found for a workflow in a
	// target keyspace.
	ErrNoStreams = errors.New("no streams found")

	tableRemovalTypeStrs = []string{
		"DROP TABLE",
		"RENAME TABLE",
	}
)

// String returns a string representation of a TableRemovalType
func (trt TableRemovalType) String() string {
	if trt < DropTable || trt > RenameTable {
		return "Unknown"
	}

	return tableRemovalTypeStrs[trt]
}

// ITrafficSwitcher is a hack to allow us to maintain the legacy wrangler
// package for vtctl/vtctlclient while migrating most of the TrafficSwitcher

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify the workflow name and that you are addressing the target keyspace: `vtctldclient Workflow --keyspace <target> Show <workflow>`.
  2. Check for streams on the target shards: `select * from _vt.vreplication where workflow='...'`.
  3. Recreate the workflow if its streams were removed, or use the correct keyspace/workflow name.

Example fix

// before
vtctldclient SwitchWrites --workflow sales commerce // ErrNoStreams (wrong keyspace)
// after
vtctldclient SwitchWrites --workflow sales customer // customer is the target keyspace
Defensive patterns

Strategy: validation

Validate before calling

streams, err := client.GetWorkflowInfo(ctx, targetKeyspace, workflow)
if err != nil || len(streams.Streams) == 0 {
    return fmt.Errorf("workflow %s has no streams in %s", workflow, targetKeyspace)
}

Type guard

func isNoStreamsErr(err error) bool {
    return errors.Is(err, workflow.ErrNoStreams)
}

Try / catch

if err := client.SwitchWrites(ctx, ks, wf, opts); err != nil {
    if errors.Is(err, workflow.ErrNoStreams) {
        // check keyspace is the target and workflow exists
    }
    return err
}

Prevention

When it happens

Trigger: Calling SwitchReads/SwitchWrites/Workflow state APIs for a workflow name that has no _vt.vreplication rows in the target keyspace, or querying the wrong (target) keyspace.

Common situations: Typo in the workflow name, running the command against the source keyspace instead of the target, or the workflow already completed/deleted so its streams are gone.

Related errors


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