{"record":{"id":"c801115a39d22027","repo":"vitessio/vitess","slug":"batch-size-conflicts-with-uuid-list-batching","errorCode":null,"errorMessage":"--batch-size conflicts with --uuid-list. Batching does not support UUIDs.","messagePattern":"--batch-size conflicts with --uuid-list\\. Batching does not support UUIDs\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schemamanager/tablet_executor.go","lineNumber":470,"sourceCode":"\t\t\t\t\texec.logger,\n\t\t\t\t\texec.keyspace,\n\t\t\t\t\tresult.Shard,\n\t\t\t\t\tresult.Position,\n\t\t\t\t\tconcurrency,\n\t\t\t\t\ttrue, /* includePrimary */\n\t\t\t\t)\n\t\t\t}(result)\n\t\t}\n\t\twg.Wait()\n\t}()\n\n\tif exec.batchSize > 1 {\n\t\t// Before we proceed to batch, we need to validate there's no conflicts.\n\t\tif !exec.isDirectStrategy() {\n\t\t\treturn errorExecResult(errors.New(\"--batch-size requires 'direct' ddl_strategy\"))\n\t\t}\n\t\tif exec.hasProvidedUUIDs() {\n\t\t\treturn errorExecResult(errors.New(\"--batch-size conflicts with --uuid-list. Batching does not support UUIDs.\"))\n\t\t}\n\t\tallSQLsAreCreate, err := allSQLsAreCreateQueries(sqls, exec.parser)\n\t\tif err != nil {\n\t\t\treturn errorExecResult(err)\n\t\t}\n\t\tif !allSQLsAreCreate {\n\t\t\treturn errorExecResult(errors.New(\"--batch-size only allowed when all queries are CREATE TABLE|VIEW\"))\n\t\t}\n\n\t\tsqls = batchSQLs(sqls, int(exec.batchSize))\n\t}\n\tfor index, sql := range sqls {\n\t\t// Attempt to renew lease:\n\t\tif err := rl.Do(func() error { return topo.CheckKeyspaceLocked(ctx, exec.keyspace) }); err != nil {\n\t\t\treturn errorExecResult(vterrors.Wrapf(err, \"CheckKeyspaceLocked in ApplySchemaKeyspace %v\", exec.keyspace))\n\t\t}\n\t\texecResult.CurSQLIndex = index\n\t\tif exec.hasProvidedUUIDs() {","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schemamanager/tablet_executor.go#L452-L488","documentation":"When batching is enabled (--batch-size > 1), schemamanager generates UUIDs for the batched statements itself and cannot honor an explicit --uuid-list. Execute checks hasProvidedUUIDs() and refuses the combination because batch grouping would desynchronize the provided UUID-per-statement mapping.","triggerScenarios":"Calling Execute/ApplySchema with both --batch-size greater than 1 and a non-empty --uuid-list.","commonSituations":"Operators extending an existing command line that already had --uuid-list by adding --batch-size; generated scripts that always supply UUID lists.","solutions":["Remove --uuid-list when using --batch-size and let the manager generate UUIDs","Remove --batch-size to keep explicit UUID control per statement","Split the workload: batch the ad-hoc DDL, run UUID-controlled migrations separately"],"exampleFix":"// before\nvtctldclient ApplySchema --sql-file d.sql --batch-size 5 --uuid-list a,b,c ks\n// after\nvtctldclient ApplySchema --sql-file d.sql --batch-size 5 ks","handlingStrategy":"validation","validationCode":"if batchSize > 1 && uuidList != \"\" {\n    return errors.New(\"--batch-size cannot be combined with --uuid-list\")\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"conflicts with --uuid-list\") {\n    // retry without --uuid-list or without --batch-size\n}","preventionTips":["Choose either explicit UUIDs or batching, never both","Strip --uuid-list from templates when batch-size is enabled","Add a preflight check in automation that builds these command lines"],"tags":["go","schemamanager","configuration","flags"],"backgroundTag":"incompatible-flag-combination","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}