{"record":{"id":"f40ee354434373df","repo":"vitessio/vitess","slug":"error-generating-onlineddl-query-v-f40ee3","errorCode":null,"errorMessage":"Error generating OnlineDDL query: %+v","messagePattern":"Error generating OnlineDDL query: %\\+v","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/vtctl.go","lineNumber":3097,"sourceCode":"\t\tapplySchemaQuery, err = generateOnlineDDLQuery(command, arg, false)\n\tcase\n\t\t\"launch\",\n\t\t\"launch-all\",\n\t\t\"complete\",\n\t\t\"complete-all\",\n\t\t\"cancel\",\n\t\t\"cancel-all\",\n\t\t\"throttle\",\n\t\t\"throttle-all\",\n\t\t\"unthrottle\",\n\t\t\"unthrottle-all\":\n\t\t// Support 'ALL' argument\n\t\tapplySchemaQuery, err = generateOnlineDDLQuery(command, arg, true)\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown OnlineDDL command: %s\", command)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error generating OnlineDDL query: %+v\", err)\n\t}\n\n\tif applySchemaQuery != \"\" {\n\t\tlog.Info(\"Calling ApplySchema on VtctldServer\")\n\n\t\tresp, err := wr.VtctldServer().ApplySchema(ctx, &vtctldatapb.ApplySchemaRequest{\n\t\t\tKeyspace:            keyspace,\n\t\t\tSql:                 []string{applySchemaQuery},\n\t\t\tWaitReplicasTimeout: protoutil.DurationToProto(grpcvtctldserver.DefaultWaitReplicasTimeout),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tloggerWriter{wr.Logger()}.Printf(\"resp: %v\\n\", resp)\n\t} else {\n\t\t// This is a SELECT. We run this on all PRIMARY tablets of this keyspace, and return the combined result\n\t\tresp, err := wr.VtctldServer().GetTablets(ctx, &vtctldatapb.GetTabletsRequest{\n\t\t\tCells:      nil,","sourceCodeStart":3079,"sourceCodeEnd":3115,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/vtctl.go#L3079-L3115","documentation":"When the OnlineDDL command is recognized, vtctl delegates SQL generation to generateOnlineDDLQuery. If that helper fails (e.g. sqlparser.ParseAndBind cannot build the ALTER VITESS_MIGRATION statement for the given UUID), the error is wrapped with this message. It indicates the command string was valid but constructing the query failed.","triggerScenarios":"A UUID argument that breaks SQL binding (empty after normalization, embedded quotes, invalid characters); generateOnlineDDLQuery returning an error for an unusual command/arg combination.","commonSituations":"Passing a malformed migration UUID (wrong separators, truncated); shell mangling of the argument; internal parser mismatch after version upgrades.","solutions":["Check the wrapped inner error (%+v) for the parser failure detail","Verify the migration UUID format (underscores, no spaces/quotes) using `workflow show` to list valid UUIDs","Quote the argument properly in the shell and retry"],"exampleFix":"// before\nvtctldclient workflow complete \"82fa7e00 f39e 11eb ...\"  # spaces break binding\n// after\nvtctldclient workflow complete 82fa7e00_f39e_11eb_a1b2_0e44e0b34e9e","handlingStrategy":"try-catch","validationCode":"// validate UUID shape first\nok := regexp.MustCompile(`^[0-9a-f_]+$`).MatchString(uuid)\nif !ok { fail(\"malformed migration UUID\") }","typeGuard":null,"tryCatchPattern":"err := runOnlineDDL(command, uuid)\nif err != nil && strings.HasPrefix(err.Error(), \"Error generating OnlineDDL query\") {\n  // inspect wrapped cause, fix the UUID/argument and retry\n}","preventionTips":["Copy UUIDs verbatim from `workflow show` output","Quote arguments in shell to avoid splitting/mangling","Keep UUID format (underscore separators) intact"],"tags":["onlineddl","sqlparser","vtctl"],"backgroundTag":"query-generation-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}