{"record":{"id":"deb474bc7200b673","repo":"vitessio/vitess","slug":"no-streams-found","errorCode":null,"errorMessage":"no streams found","messagePattern":"no streams found","errorType":"error_code","errorClass":"ErrNoStreams","httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/traffic_switcher.go","lineNumber":121,"sourceCode":"\n// TrafficSwitchDirection specifies the switching direction.\ntype TrafficSwitchDirection int\n\nfunc (tsd TrafficSwitchDirection) String() string {\n\tif tsd == DirectionForward {\n\t\treturn \"forward\"\n\t}\n\treturn \"backward\"\n}\n\n// TableRemovalType specifies the way the a table will be removed during a\n// DropSource for a MoveTables workflow.\ntype TableRemovalType int\n\nvar (\n\t// ErrNoStreams occurs when no target streams are found for a workflow in a\n\t// target keyspace.\n\tErrNoStreams = errors.New(\"no streams found\")\n\n\ttableRemovalTypeStrs = []string{\n\t\t\"DROP TABLE\",\n\t\t\"RENAME TABLE\",\n\t}\n)\n\n// String returns a string representation of a TableRemovalType\nfunc (trt TableRemovalType) String() string {\n\tif trt < DropTable || trt > RenameTable {\n\t\treturn \"Unknown\"\n\t}\n\n\treturn tableRemovalTypeStrs[trt]\n}\n\n// ITrafficSwitcher is a hack to allow us to maintain the legacy wrangler\n// package for vtctl/vtctlclient while migrating most of the TrafficSwitcher","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/traffic_switcher.go#L103-L139","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the workflow name and that you are addressing the target keyspace: `vtctldclient Workflow --keyspace <target> Show <workflow>`.","Check for streams on the target shards: `select * from _vt.vreplication where workflow='...'`.","Recreate the workflow if its streams were removed, or use the correct keyspace/workflow name."],"exampleFix":"// before\nvtctldclient SwitchWrites --workflow sales commerce // ErrNoStreams (wrong keyspace)\n// after\nvtctldclient SwitchWrites --workflow sales customer // customer is the target keyspace","handlingStrategy":"validation","validationCode":"streams, err := client.GetWorkflowInfo(ctx, targetKeyspace, workflow)\nif err != nil || len(streams.Streams) == 0 {\n    return fmt.Errorf(\"workflow %s has no streams in %s\", workflow, targetKeyspace)\n}","typeGuard":"func isNoStreamsErr(err error) bool {\n    return errors.Is(err, workflow.ErrNoStreams)\n}","tryCatchPattern":"if err := client.SwitchWrites(ctx, ks, wf, opts); err != nil {\n    if errors.Is(err, workflow.ErrNoStreams) {\n        // check keyspace is the target and workflow exists\n    }\n    return err\n}","preventionTips":["Address the target keyspace, not the source, in switch commands","Confirm the workflow exists before switching traffic","Remember streams are removed once a workflow completes"],"tags":["vitess","vreplication","traffic-switch","missing-streams"],"backgroundTag":"no-vreplication-streams","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}