{"record":{"id":"2df078359f476fbc","repo":"vitessio/vitess","slug":"w-in-keyspace-s-for-s","errorCode":null,"errorMessage":"%w in keyspace %s for %s","messagePattern":"%w in keyspace (.+?) for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/utils.go","lineNumber":427,"sourceCode":"\t\toptionsJSON := wf.GetOptions()\n\t\tif optionsJSON != \"\" {\n\t\t\tif err := json.Unmarshal([]byte(optionsJSON), &options); err != nil {\n\t\t\t\treturn nil, vterrors.Wrapf(err, \"failed to unmarshal options: %s\", optionsJSON)\n\t\t\t}\n\t\t}\n\n\t\tfor _, stream := range wf.Streams {\n\t\t\tif stream.Message == Frozen {\n\t\t\t\tfrozen = true\n\t\t\t}\n\t\t\ttarget.Sources[stream.Id] = stream.Bls\n\t\t}\n\n\t\ttargets[targetShardName] = target\n\t}\n\n\tif len(targets) == 0 {\n\t\treturn nil, fmt.Errorf(\"%w in keyspace %s for %s\", ErrNoStreams, targetKeyspace, workflow)\n\t}\n\n\treturn &TargetInfo{\n\t\tTargets:         targets,\n\t\tFrozen:          frozen,\n\t\tOptCells:        optCells,\n\t\tOptTabletTypes:  optTabletTypes,\n\t\tWorkflowType:    workflowType,\n\t\tWorkflowSubType: workflowSubType,\n\t\tOptions:         &options,\n\t}, nil\n}\n\nfunc getSourceAndTargetKeyRanges(sourceShards, targetShards []string) (*topodatapb.KeyRange, *topodatapb.KeyRange, error) {\n\tif len(sourceShards) == 0 || len(targetShards) == 0 {\n\t\treturn nil, nil, errors.New(\"either source or target shards are missing\")\n\t}\n","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/utils.go#L409-L445","documentation":"BuildTargets collects the target shards/streams for a workflow in the target keyspace; if it ends up with zero targets, it returns this error wrapping the sentinel ErrNoStreams, including the keyspace and workflow name. It means no running vreplication streams (target tablets) were found for the workflow, so traffic switching or workflow operations cannot proceed.","triggerScenarios":"Calling a workflow command (SwitchTraffic/Complete/Cancel, via buildTrafficSwitcher) on a workflow that has no vreplication streams — e.g. the workflow was already completed/cancelled, never started, or targets are down — and GetWorkflows/streams queries return nothing.","commonSituations":"Running CompleteMoveTables twice; wrong -workflow name typo; workflow exists in a different keyspace; target tablets removed or workflow streams purged before switching traffic.","solutions":["Verify the workflow name and keyspace with `Workflow GetWorkflows` / vtctldclient GetWorkflows; correct typos.","Check that the workflow still has active streams (`Show` on the workflow / query the _vt.vreplication table on target primaries).","If the workflow already finished, use the appropriate command (e.g. it is already complete) instead of switching traffic; if it should be running, restart/recreate it."],"exampleFix":"// before\nvtctldclient MoveTables --workflow wrong_name --target-keyspace customer SwitchTraffic\n// error: no streams in keyspace customer for wrong_name\n// after\nvtctldclient GetWorkflows --keyspace customer\nvtctldclient MoveTables --workflow sales2customer --target-keyspace customer SwitchTraffic","handlingStrategy":"validation","validationCode":"// check the workflow has streams before switching traffic\nout, err := exec.Command(\"vtctldclient\", \"GetWorkflows\", \"--keyspace\", ks).Output()\nif err != nil || !strings.Contains(string(out), workflow) {\n    return fmt.Errorf(\"workflow %s not found in %s\", workflow, ks)\n}","typeGuard":null,"tryCatchPattern":"if err := ts.SwitchTraffic(ctx, workflow); err != nil {\n    if errors.Is(err, workflow.ErrNoStreams) {\n        // workflow missing/already finished: inspect GetWorkflows and re-plan\n        return inspectAndReplan(workflow)\n    }\n    return err\n}","preventionTips":["Verify workflow name/keyspace with GetWorkflows before operating on it.","Never run Complete/SwitchTraffic twice; track workflow state externally.","Keep target tablets up so streams exist during the migration lifecycle."],"tags":["go","vreplication","workflow","topology"],"backgroundTag":"no-vreplication-streams","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}