{"record":{"id":"2524793836160748","repo":"vitessio/vitess","slug":"dry-run-is-only-supported-for-switchtraffic-rev","errorCode":null,"errorMessage":"--dry_run is only supported for SwitchTraffic, ReverseTraffic and Complete, not for %s","messagePattern":"--dry_run is only supported for SwitchTraffic, ReverseTraffic and Complete, not for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":2386,"sourceCode":"\t\t\t\t}\n\t\t\t\tif progress.SourceTableSize > 0 {\n\t\t\t\t\ttableSizePct = 100.0 * progress.TargetTableSize / progress.SourceTableSize\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(&sSb2360, \"%s: rows copied %d/%d (%d%%), size copied %d/%d (%d%%)\\n\",\n\t\t\t\t\ttable, progress.TargetRowCount, progress.SourceRowCount, rowCountPct,\n\t\t\t\t\tprogress.TargetTableSize, progress.SourceTableSize, tableSizePct)\n\t\t\t}\n\t\t\ts += sSb2360.String()\n\t\t\twr.Logger().Printf(\"\\n%s\\n\", s)\n\t\t}\n\t\treturn printDetails()\n\t}\n\n\tif *dryRun {\n\t\tswitch action {\n\t\tcase vReplicationWorkflowActionSwitchTraffic, vReplicationWorkflowActionReverseTraffic, vReplicationWorkflowActionComplete:\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"--dry_run is only supported for SwitchTraffic, ReverseTraffic and Complete, not for %s\", originalAction)\n\t\t}\n\t}\n\n\twr.WorkflowParams = vrwp\n\n\tswitch vrwp.WorkflowType {\n\tcase wrangler.MoveTablesWorkflow:\n\t\t// If this is not a partial MoveTables, SourceShards is nil and all shards will be polled.\n\t\tshardsWithStreams = vrwp.SourceShards\n\tcase wrangler.ReshardWorkflow:\n\t\tshardsWithStreams = vrwp.TargetShards\n\tdefault:\n\t}\n\n\twr.WorkflowParams = vrwp\n\tvar dryRunResults *[]string\n\tstartState := wf.CachedState()\n\tswitch action {","sourceCodeStart":2368,"sourceCodeEnd":2404,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L2368-L2404","documentation":"The --dry_run flag is only meaningful for the SwitchTraffic, ReverseTraffic, and Complete actions of a vreplication workflow. Passing --dry_run with any other action is rejected so users are not misled into thinking a preview occurred. The error names the actual action that was given.","triggerScenarios":"`vtctldclient ... create --dry_run`, `cancel --dry_run`, `show --dry_run`, etc.; scripted dry-run attempts against StartTraffic/StopTraffic or Cancel actions.","commonSituations":"Users assuming dry-run is universally supported across workflow actions; converting a SwitchTraffic dry-run script to a Cancel action while keeping the flag.","solutions":["Remove --dry_run for this action","Restrict dry-run usage to SwitchTraffic, ReverseTraffic, or Complete actions","Preview the change another way, e.g. inspect workflow state with `show`"],"exampleFix":"// before\nvtctldclient Reshard cancel commerce.reshard --dry_run\n// after\nvtctldclient Reshard complete commerce.reshard --dry_run  # or drop --dry_run for cancel","handlingStrategy":"validation","validationCode":"dryRunAllowed := map[string]bool{\"switchtraffic\": true, \"reversetraffic\": true, \"complete\": true}\nif dryRun && !dryRunAllowed[action] {\n  // drop --dry_run or change action\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only attach --dry_run to SwitchTraffic/ReverseTraffic/Complete invocations","Keep dry-run and live-action script templates separate"],"tags":["vreplication","flag-validation","vtctl"],"backgroundTag":"unsupported-flag-action-combination","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}