{"record":{"id":"9aa7624e498fa349","repo":"vitessio/vitess","slug":"no-sources-found-for-workflow-s-s","errorCode":null,"errorMessage":"no sources found for workflow %s.%s","messagePattern":"no sources found for workflow (.+?)\\.(.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/workflow.go","lineNumber":697,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttableSize, err := qr.Rows[i][2].ToCastInt64()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t(*rowCounts)[table] += rowCount\n\t\t\t(*tableSizes)[table] += tableSize\n\t\t}\n\t\treturn nil\n\t}\n\tsourceDbName := \"\"\n\tfor _, tsSource := range vrw.ts.sources {\n\t\tsourceDbName = tsSource.GetPrimary().DbName()\n\t\tbreak\n\t}\n\tif sourceDbName == \"\" {\n\t\treturn nil, fmt.Errorf(\"no sources found for workflow %s.%s\", vrw.ws.TargetKeyspace, vrw.ws.Workflow)\n\t}\n\ttargetDbName := \"\"\n\tfor _, tsTarget := range vrw.ts.targets {\n\t\ttargetDbName = tsTarget.GetPrimary().DbName()\n\t\tbreak\n\t}\n\tif sourceDbName == \"\" || targetDbName == \"\" {\n\t\treturn nil, fmt.Errorf(\"workflow %s.%s is incorrectly configured\", vrw.ws.TargetKeyspace, vrw.ws.Workflow)\n\t}\n\tsort.Strings(tableList) // sort list for repeatability for mocking in tests\n\ttablesStr := strings.Join(tableList, \",\")\n\tquery := fmt.Sprintf(getRowCountQuery, encodeString(targetDbName), tablesStr)\n\tfor _, target := range vrw.ts.targets {\n\t\ttablet := target.GetPrimary().Tablet\n\t\tif err := getTableMetrics(tablet, query, &targetRowCounts, &targetTableSizes); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}","sourceCodeStart":679,"sourceCodeEnd":715,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/workflow.go#L679-L715","documentation":"This error is returned by the wrangler when building a rowCount/progress query for a workflow: it scans vrw.ts.sources for the first source tablet primary to derive sourceDbName, and if the TabletSet has zero sources the name is empty. It means the workflow's shard/status data contains no source entries, so the operation cannot proceed.","triggerScenarios":"Calling wrangler workflow row-count or similar plumbing (e.g. GetRowCount flow) when vrw.ts.sources is empty — e.g. querying a workflow whose source keycase has no tablets, or the workflow state was fetched for a keyspace with no matching shards.","commonSituations":"Typo'd keyspace/workflow name when running workflows commands (MoveTables/Reshard status); workflow torn down so source tablets are gone; vtctld connected to a topo where the source keyspace has no serving tablets.","solutions":["Verify the workflow and target keyspace names with `vtctldclient GetWorkflows <keyspace>` and use the exact names","Check the source keyspace has healthy primary tablets (`vtctldclient GetTablets`)","Re-fetch workflow state; if the workflow was finished/torn down, the operation is no longer valid"],"exampleFix":"// before\nwrangler.GetRowCount(ctx, workflow, keyspace, tables) // keyspace has no sources\n// after\n// confirm workflow exists and sources exist first\nworkflows, _ := wrangler.GetWorkflows(ctx, keyspace, \"\")\n// only call if the workflow appears with non-empty sources","handlingStrategy":"validation","validationCode":"ts, err := wrangler.SnapshotTables(ctx, keyspace, workflow)\nif err != nil { return err }\nif len(ts.Sources) == 0 {\n    return fmt.Errorf(\"workflow %s has no sources; check keyspace/workflow name\", workflow)\n}","typeGuard":"func hasSources(ts *tabletset.Set) bool { return len(ts.Sources) > 0 }","tryCatchPattern":"// Go: check returned error\nif err != nil {\n    if strings.Contains(err.Error(), \"no sources found\") {\n        // fall back to listing workflows for the user\n    }\n    return err\n}","preventionTips":["Always resolve workflow names via GetWorkflows before row-count/status commands","Confirm source keyspace has serving primaries before operating","Watch for teardown having removed sources before querying"],"tags":["wrangler","workflow","vreplication"],"backgroundTag":"workflow-no-sources","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}