{"record":{"id":"427093f52bd4099a","repo":"vitessio/vitess","slug":"both-atomic-copy-and-partial-mode-cannot-be-specif","errorCode":null,"errorMessage":"both atomic copy and partial mode cannot be specified for the same workflow","messagePattern":"both atomic copy and partial mode cannot be specified for the same workflow","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/materializer.go","lineNumber":100,"sourceCode":"\nfunc (mz *materializer) getWorkflowType() binlogdatapb.VReplicationWorkflowType {\n\tvar workflowType binlogdatapb.VReplicationWorkflowType\n\tswitch mz.ms.MaterializationIntent {\n\tcase vtctldatapb.MaterializationIntent_CUSTOM:\n\t\tworkflowType = binlogdatapb.VReplicationWorkflowType_Materialize\n\tcase vtctldatapb.MaterializationIntent_MOVETABLES:\n\t\tworkflowType = binlogdatapb.VReplicationWorkflowType_MoveTables\n\tcase vtctldatapb.MaterializationIntent_CREATELOOKUPINDEX:\n\t\tworkflowType = binlogdatapb.VReplicationWorkflowType_CreateLookupIndex\n\t}\n\treturn workflowType\n}\n\nfunc (mz *materializer) getWorkflowSubType() (binlogdatapb.VReplicationWorkflowSubType, error) {\n\tswitch {\n\tcase mz.isPartial && mz.ms.AtomicCopy:\n\t\treturn binlogdatapb.VReplicationWorkflowSubType_None,\n\t\t\terrors.New(\"both atomic copy and partial mode cannot be specified for the same workflow\")\n\tcase mz.isPartial:\n\t\treturn binlogdatapb.VReplicationWorkflowSubType_Partial, nil\n\tcase mz.ms.AtomicCopy:\n\t\treturn binlogdatapb.VReplicationWorkflowSubType_AtomicCopy, nil\n\tdefault:\n\t\treturn binlogdatapb.VReplicationWorkflowSubType_None, nil\n\t}\n}\n\nfunc (mz *materializer) getOptionsJSON() (string, error) {\n\tdefaultJSON := \"{}\"\n\tif mz.ms.WorkflowOptions == nil {\n\t\treturn defaultJSON, nil\n\t}\n\toptionsJSON, err := json.Marshal(mz.ms.WorkflowOptions)\n\tif err != nil || optionsJSON == nil {\n\t\treturn defaultJSON, err\n\t}","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/materializer.go#L82-L118","documentation":"The materializer refuses to create a vreplication workflow that requests both atomic copy and partial mode simultaneously, because these are mutually exclusive copy strategies. getWorkflowSubType maps the materializer's flags (isPartial and ms.AtomicCopy) to a VReplicationWorkflowSubType, and the combination is considered invalid input. It returns VReplicationWorkflowSubType_None along with this error so callers like createWorkflowStreams abort stream creation.","triggerScenarios":"Calling MoveTables/LaunchMaterialize (createWorkflowStreams or generateInserts path) with a MaterializerSpec whose AtomicCopy flag is true while the workflow was detected as partial (isPartial, e.g. only a subset of tables/columns being copied in an existing workflow).","commonSituations":"A user passes --atomic-copy (or sets AtomicCopy in the spec) on a MoveTables command that is only copying a partial set of tables into an existing workflow, or two tooling layers each set one of the flags independently.","solutions":["Remove the AtomicCopy flag from the workflow invocation since partial mode is already in effect, or vice versa.","If an atomic copy is required, recreate/extend the workflow so it copies all tables in one shot instead of partial mode.","Check the workflow spec/CLI flags for conflicting options before launching; only set one of AtomicCopy or partial."],"exampleFix":"// before\nmz := newMaterializer(ts, ctx, spec) // spec.AtomicCopy=true, workflow is partial\nsubType, err := mz.getWorkflowSubType() // error\n// after\nspec.AtomicCopy = false // drop atomic copy for partial workflows\nsubType, err := mz.getWorkflowSubType() // VReplicationWorkflowSubType_Partial","handlingStrategy":"validation","validationCode":"if mz.isPartial && mz.ms.AtomicCopy {\n    return fmt.Errorf(\"cannot specify both atomic copy and partial mode for workflow %s\", mz.ms.Workflow)\n}","typeGuard":null,"tryCatchPattern":"if err := launchWorkflow(spec); err != nil {\n    if strings.Contains(err.Error(), \"both atomic copy and partial mode\") {\n        spec.AtomicCopy = false\n        return launchWorkflow(spec)\n    }\n    return err\n}","preventionTips":["Set only one of AtomicCopy or partial mode per workflow spec","Validate flags in CLI PreRunE before constructing the MaterializerSpec","Document the mutual exclusivity in flag help text"],"tags":["vitess","vreplication","workflow","invalid-argument"],"backgroundTag":"conflicting-workflow-options","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}