{"record":{"id":"9a5341925d6fccc2","repo":"vitessio/vitess","slug":"validateworkflowname-vreplicationexec-dynamic-va","errorCode":null,"errorMessage":"validateWorkflowName.VReplicationExec: <dynamic validation.msg from workflow validation query>","messagePattern":"validateWorkflowName\\.VReplicationExec: <dynamic validation\\.msg from workflow validation query>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/keyspace.go","lineNumber":85,"sourceCode":"\t\t\tvalidations := []struct {\n\t\t\t\tquery string\n\t\t\t\tmsg   string\n\t\t\t}{{\n\t\t\t\tfmt.Sprintf(\"select 1 from _vt.vreplication where db_name=%s and workflow=%s\", encodeString(primary.DbName()), encodeString(workflow)),\n\t\t\t\tfmt.Sprintf(\"workflow %s already exists in keyspace %s on tablet %d\", workflow, keyspace, primary.Alias.Uid),\n\t\t\t}, {\n\t\t\t\tfmt.Sprintf(\"select 1 from _vt.vreplication where db_name=%s and message='FROZEN' and workflow_sub_type != %d\", encodeString(primary.DbName()), binlogdatapb.VReplicationWorkflowSubType_Partial),\n\t\t\t\tfmt.Sprintf(\"found previous frozen workflow on tablet %d, please review and delete it first before creating a new workflow\",\n\t\t\t\t\tprimary.Alias.Uid),\n\t\t\t}}\n\t\t\tfor _, validation := range validations {\n\t\t\t\tp3qr, err := wr.tmc.VReplicationExec(ctx, primary.Tablet, validation.query)\n\t\t\t\tif err != nil {\n\t\t\t\t\tallErrors.RecordError(vterrors.Wrap(err, \"validateWorkflowName.VReplicationExec\"))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif p3qr != nil && len(p3qr.Rows) != 0 {\n\t\t\t\t\tallErrors.RecordError(vterrors.Wrap(errors.New(validation.msg), \"validateWorkflowName.VReplicationExec\"))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}(si)\n\t}\n\twg.Wait()\n\treturn allErrors.AggrError(vterrors.Aggregate)\n}\n\n// refreshPrimaryTablets will just RPC-ping all the primary tablets with RefreshState\nfunc (wr *Wrangler) refreshPrimaryTablets(ctx context.Context, shards []*topo.ShardInfo) error {\n\twg := sync.WaitGroup{}\n\trec := concurrency.AllErrorRecorder{}\n\tfor _, si := range shards {\n\t\twg.Add(1)\n\t\tgo func(si *topo.ShardInfo) {\n\t\t\tdefer wg.Done()\n\t\t\twr.Logger().Infof(\"RefreshState primary %v\", topoproto.TabletAliasString(si.PrimaryAlias))","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/keyspace.go#L67-L103","documentation":"During workflow-name validation, wrangler ran a validation query against the primary tablet via VReplicationExec and either the query failed or it returned rows, meaning the workflow name/state fails validation. The recorded message wraps either the query error or the dynamic validation.msg describing the problem found. It indicates a workflow in the keyspace does not satisfy the expected invariants (e.g. unexpected state or stale streams).","triggerScenarios":"Calling keyspace validation (e.g. vtctldclient ValidateWorkflowName / Keyspace validation paths in wrangler) while a validation.query on the primary tablet returns rows signaling an invalid workflow name condition.","commonSituations":"Stale or manually created rows in _vt.vreplication conflicting with the workflow name; validation run before/after a partially completed MoveTables; version mismatches where the tablet's schema for _vt tables differs.","solutions":["Read the inner validation.msg in the wrapped error to see exactly which query/condition failed","Inspect _vt.vreplication rows on the primary tablet (mysql -e 'select * from _vt.vreplication') and remove stale entries","Fix the underlying VReplicationExec failure (tablet connectivity, permissions) if the error is a query error","Re-run the validation command after cleanup"],"exampleFix":"-- inspect and clean stale streams\nSELECT workflow, id FROM _vt.vreplication WHERE db_name='vt_ks';\nDELETE FROM _vt.vreplication WHERE workflow='<bad>' AND workflow_state='Cancelled';","handlingStrategy":"try-catch","validationCode":"-- pre-check the primary's vreplication state yourself\nSELECT workflow, workflow_state FROM _vt.vreplication WHERE db_name='vt_<ks>';","typeGuard":null,"tryCatchPattern":"if err := wr.validateWorkflowName(ctx, keyspace); err != nil {\n\tvar allErr error\n\t// unwrap to find inner validation.msg or VReplicationExec failure\n\tlog.Printf(\"workflow validation failed: %v\", err)\n\treturn err\n}","preventionTips":["Clean up cancelled/failed workflows before running validation","Ensure tablets are reachable and VReplicationExec permissions are in place","Run validation only on quiescent keyspaces (no in-flight migrations)"],"tags":["wrangler","validation","vreplication"],"backgroundTag":"workflow-validation-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}