vitessio/vitess · error

no sources found for workflow %s.%s

Error message

no sources found for workflow %s.%s

What it means

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.

Source

Thrown at go/vt/wrangler/workflow.go:697

			if err != nil {
				return err
			}
			tableSize, err := qr.Rows[i][2].ToCastInt64()
			if err != nil {
				return err
			}
			(*rowCounts)[table] += rowCount
			(*tableSizes)[table] += tableSize
		}
		return nil
	}
	sourceDbName := ""
	for _, tsSource := range vrw.ts.sources {
		sourceDbName = tsSource.GetPrimary().DbName()
		break
	}
	if sourceDbName == "" {
		return nil, fmt.Errorf("no sources found for workflow %s.%s", vrw.ws.TargetKeyspace, vrw.ws.Workflow)
	}
	targetDbName := ""
	for _, tsTarget := range vrw.ts.targets {
		targetDbName = tsTarget.GetPrimary().DbName()
		break
	}
	if sourceDbName == "" || targetDbName == "" {
		return nil, fmt.Errorf("workflow %s.%s is incorrectly configured", vrw.ws.TargetKeyspace, vrw.ws.Workflow)
	}
	sort.Strings(tableList) // sort list for repeatability for mocking in tests
	tablesStr := strings.Join(tableList, ",")
	query := fmt.Sprintf(getRowCountQuery, encodeString(targetDbName), tablesStr)
	for _, target := range vrw.ts.targets {
		tablet := target.GetPrimary().Tablet
		if err := getTableMetrics(tablet, query, &targetRowCounts, &targetTableSizes); err != nil {
			return nil, err
		}
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Verify the workflow and target keyspace names with `vtctldclient GetWorkflows <keyspace>` and use the exact names
  2. Check the source keyspace has healthy primary tablets (`vtctldclient GetTablets`)
  3. Re-fetch workflow state; if the workflow was finished/torn down, the operation is no longer valid

Example fix

// before
wrangler.GetRowCount(ctx, workflow, keyspace, tables) // keyspace has no sources
// after
// confirm workflow exists and sources exist first
workflows, _ := wrangler.GetWorkflows(ctx, keyspace, "")
// only call if the workflow appears with non-empty sources
Defensive patterns

Strategy: validation

Validate before calling

ts, err := wrangler.SnapshotTables(ctx, keyspace, workflow)
if err != nil { return err }
if len(ts.Sources) == 0 {
    return fmt.Errorf("workflow %s has no sources; check keyspace/workflow name", workflow)
}

Type guard

func hasSources(ts *tabletset.Set) bool { return len(ts.Sources) > 0 }

Try / catch

// Go: check returned error
if err != nil {
    if strings.Contains(err.Error(), "no sources found") {
        // fall back to listing workflows for the user
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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