{"record":{"id":"43a1ff5e15d06e81","repo":"vitessio/vitess","slug":"table-not-supported-by-vexec","errorCode":null,"errorMessage":"table not supported by vexec","messagePattern":"table not supported by vexec","errorType":"error_code","errorClass":"ErrUnsupportedTable","httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/vexec/vexec.go","lineNumber":67,"sourceCode":")\n\nvar ( // Topo lookup errors.\n\t// ErrNoShardPrimary occurs when a shard is found with no serving\n\t// primary.\n\tErrNoShardPrimary = errors.New(\"no primary found for shard\")\n\t// ErrNoShardsForKeyspace occurs when attempting to run a vexec on an empty\n\t// keyspace.\n\tErrNoShardsForKeyspace = errors.New(\"no shards found in keyspace\")\n)\n\nvar ( // Query parsing and planning errors.\n\t// ErrUnsupportedQuery occurs when attempting to run an unsupported query\n\t// through vexec.\n\tErrUnsupportedQuery = errors.New(\"query not supported by vexec\")\n\t// ErrUnsupportedTable occurs when attempting to run vexec on an unsupported\n\t// table. At the time of writing, this occurs when attempting to query any\n\t// table other than _vt.vreplication.\n\tErrUnsupportedTable = errors.New(\"table not supported by vexec\")\n)\n\n// VExec provides the main interface to planning and executing vexec queries\n// (normally, queries on tables in the `_vt` database). It currently supports\n// some limited vreplication queries; this set of supported behavior will expand\n// over time. It may be extended to support schema_migrations queries as well.\ntype VExec struct {\n\tts  *topo.Server\n\ttmc tmclient.TabletManagerClient\n\n\tkeyspace string\n\tworkflow string\n\n\t// (TODO:@ajm188) Consider renaming this field to \"targets\", and then\n\t// support different Strategy functions for loading target tablets from a\n\t// topo.Server.\n\t//\n\t// For this, I'm currently thinking:","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/vexec/vexec.go#L49-L85","documentation":"ErrUnsupportedTable is returned by getPlanner when a vexec statement targets a table other than _vt.vreplication. vexec's planners are table-specific; only the vreplication table has a planner registered, so any other table (including other _vt tables like _vt.schema_migrations) is rejected with this sentinel error.","triggerScenarios":"Calling vexec.PlanQuery (or running a vexec command) with a statement whose target table is not _vt.vreplication — e.g. 'UPDATE _vt.schema_migrations ...' or a query on a user table.","commonSituations":"Assuming VExec is a generic proxy for _vt schema queries; trying schema_migrations operations through vexec before that support was added; scripts written against user keyspaces mistakenly routed through vexec.","solutions":["Target only _vt.vreplication with vexec for now.","For schema_migrations operations, use vtctldclient ApplySchema / MigrationStatus commands instead.","For user tables, connect to VTGate and run the query normally rather than through vexec."],"exampleFix":"// before\nvexec.Run(ctx, ts, \"DELETE FROM _vt.schema_migrations WHERE id=5\", \"commerce\")\n// after\n// use the dedicated command instead\nvtctldclient schema-migration-complete commerce <uuid>","handlingStrategy":"validation","validationCode":"stmt, _ := sqlparser.Parse(q)\ntable := sqlparser.String(sqlparser.GetTableName(sqlparser.GetFirstSelect stmtTableExpr)) // resolve target table first\nif table != \"_vt.vreplication\" { return fmt.Errorf(\"vexec only supports _vt.vreplication, got %s\", table) }","typeGuard":null,"tryCatchPattern":"_, err := vexec.PlanQuery(ctx, ts, keyspace, q)\nif errors.Is(err, vexec.ErrUnsupportedTable) {\n    // reroute to vtctldclient (ApplySchema etc.) instead of vexec\n    return err\n}","preventionTips":["Only send _vt.vreplication statements to vexec.","Use ApplySchema/OnlineDDL commands for schema_migrations.","Document in tooling which tables vexec supports."],"tags":["vexec","vreplication","unsupported-table"],"backgroundTag":"unsupported-table-vexec","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}